bbarhate
08-22-2016, 03:32 AM
Hi , I am a new learner and started with learning small codes as of now.
I wanted to write a code which will color cell A1 of sheet3 in workbook named Selected Ranges.xlsm. I have written following code and it is giving error mentioned in subject when pressing F8 at line Worksheets("Selecting Ranges.xlsm").select. please help with this. Why is it giving error? and how should you approach the error when similar error comes?
Sub ColorCellA1()
Worksheets("Selecting Ranges.xlsm").select
Worksheets("Sheet3").Select
Cells.ClearFormats
Cells(1, 1) = RGB(75, 139, 203)
End Sub
I wanted to write a code which will color cell A1 of sheet3 in workbook named Selected Ranges.xlsm. I have written following code and it is giving error mentioned in subject when pressing F8 at line Worksheets("Selecting Ranges.xlsm").select. please help with this. Why is it giving error? and how should you approach the error when similar error comes?
Sub ColorCellA1()
Worksheets("Selecting Ranges.xlsm").select
Worksheets("Sheet3").Select
Cells.ClearFormats
Cells(1, 1) = RGB(75, 139, 203)
End Sub