Hi I created a macro where I highlight some cells in Sheet1 and then go back to Sheet2.
Sub highlight()
' Keyboard Shortcut: Ctrl+s
'
Sheets("Sheet1").Select
Application.Run "BLPLinkReset"
Range("C4:C10").Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Sheets("Sheet2").Select
Application.Run "BLPLinkReset"
End Sub
This macro works fine but when I put it inside a Command Button (see below) I get an error message saying "Run-time error'1004': Select method of Range class failed"
Private Sub CommandButton1_Click()
Sheets("Sheet1").Select
Application.Run "BLPLinkReset"
Range("C4:C10").Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Sheets("Sheet2").Select
Application.Run "BLPLinkR"
End Sub
How should code inside Command Button look so that it works?
Thanks,
Nix
Bookmarks