Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a simple sub to highlight some cells, is there anyway to make this run on only sheet 1 but not sheet 2 and 3 in a workbook when I press Ctrl+g?
Thanks, Example Sub macro1( ' Keyboard Shortcut: Ctrl+ Range("A1:B1").Selec With Selection.Interio .ColorIndex = .Pattern = xlSoli End Wit End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try Sub macro1() ' ' Keyboard Shortcut: Ctrl+g ' if LCase(Activesheet.name) <"sheet1" then exit sub end if with activesheet.Range("A1:B1").interior .ColorIndex = 4 .Pattern = xlSolid End With End Sub -- Regards Frank Kabel Frankfurt, Germany "dennc01" schrieb im Newsbeitrag ... I have a simple sub to highlight some cells, is there anyway to make this run on only sheet 1 but not sheet 2 and 3 in a workbook when I press Ctrl+g? Thanks, Example: Sub macro1() ' ' Keyboard Shortcut: Ctrl+g ' Range("A1:B1").Select With Selection.Interior .ColorIndex = 4 .Pattern = xlSolid End With End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub colorit()
With Sheets("sheet1").Range("A1:B1").Interior .ColorIndex = 4 .Pattern = xlSolid End With End Sub -- Don Guillett SalesAid Software "dennc01" wrote in message ... I have a simple sub to highlight some cells, is there anyway to make this run on only sheet 1 but not sheet 2 and 3 in a workbook when I press Ctrl+g? Thanks, Example: Sub macro1() ' ' Keyboard Shortcut: Ctrl+g ' Range("A1:B1").Select With Selection.Interior .ColorIndex = 4 .Pattern = xlSolid End With End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Denn,
Do you mean Sub macro1() ' ' Keyboard Shortcut: Ctrl+g ' If Activesheet.Name = "Sheet1" Then Range("A1:B1").Select With Selection.Interior .ColorIndex = 4 .Pattern = xlSolid End With End If End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "dennc01" wrote in message ... I have a simple sub to highlight some cells, is there anyway to make this run on only sheet 1 but not sheet 2 and 3 in a workbook when I press Ctrl+g? Thanks, Example: Sub macro1() ' ' Keyboard Shortcut: Ctrl+g ' Range("A1:B1").Select With Selection.Interior .ColorIndex = 4 .Pattern = xlSolid End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Link one worksheet in a workbook to another worksheet in same work | Excel Discussion (Misc queries) | |||
Macro to update a column in a work based on another work sheet | New Users to Excel | |||
Retrieving data into worksheet from another worksheet in same work | Excel Discussion (Misc queries) | |||
Copying the active worksheet to another worksheet in the same work | Excel Worksheet Functions | |||
Macro works Macro does not work | Excel Discussion (Misc queries) |