View Single Post
  #8   Report Post  
Frazer
 
Posts: n/a
Default

Ok basically what I am doing is trying to find a way in which the following
macro can be used without me having to run it, as i have too many of them,
which takes a long time:

Sub Macro1()
Dim cnt As Integer
cnt = 1

For Each c In Worksheets("Sheet1").Range("T1:T10").Cells
Range("T" & cnt).Select
On Error Resume Next
Selection.Hyperlinks(1).Follow NewWindow:=False,
AddHistory:=True
cnt = cnt + 1
Next
End Sub

Its a macro that opens up links within a certain range that are in my
spreadsheet.

Basically i need some way to make this work when a certain value, or
conditional formatting, changes in my spreadhseet. I thought i could do this
with an IF function, simply by changing a value, but obviously this does not
work, so I just need some way of making it work.....can you help??

I tried using that code you said before, but to be honest i have no idea
what Im doing, im not really that great on excel, so if you could just
explain it to me as well in lamens terms that would be cool




"Bob Phillips" wrote:

Here is a simple example

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$A$1" Then
If .Value = "xxx" Then
'do your stuff
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Frazer" wrote in message
...
How do i do that??? (Not the conditional formatting part- how can i run

code
based on the change), and can this be used to start a macro??

"Bob Phillips" wrote:

No it isn't.

You can use conditional formatting to format that cell or event code to

pick
up the change and run code based on that change.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Frazer" wrote in message
...
Finally one macro problem solved, so i begin another......

is it possible to start a macro using an IF function


i.e if cell 1 shows a 0, the macro is off, but when it changes to 1

the
macro starts running.....

is this possible??

Thnx for help in advance??