A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Run macro according to value of a cell



 
 
Thread Tools Display Modes
  #1  
Old September 1st, 2008, 04:40 AM posted to microsoft.public.excel.worksheet.functions
Kashyap
external usenet poster
 
Posts: 59
Default Run macro according to value of a cell

How to make a macro run automatically according to a value of a cell?

Eq: once we enter value '5' in cell G8, then a particular macro should run 5
times
  #2  
Old September 1st, 2008, 05:09 AM posted to microsoft.public.excel.worksheet.functions
Héctor Miguel
external usenet poster
 
Posts: 298
Default Run macro according to value of a cell

hi, !

How to make a macro run automatically according to a value of a cell?
Eq: once we enter value '5' in cell G8, then a particular macro should run 5 times


copy/paste (or type) the following in "that" worlksheet code module
(right-click its tab/name and choose: "viwe code")

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address "$G$8" Then Exit Sub Else Dim n As Byte
For n = 1 To Val(Range("g8"))
Macro1
Next
End Sub

hth,
hector.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.