excel - Changing formatting of a cell in a different worksheet -
first time question apologies if it's not detailed should be. y'all have been super helpful getting me through first vba script far, haven't been able find solution problem. here is!
i'm trying write button on worksheet 1 when hit can change formatting of specific cells on worksheet 2. specific code i'm trying follows:
if cells(i, 6).value <> "" , cells(i, 5).value <> "" worksheets("info").range("f5").interior.color = rgb(255, 0, 0) end if
this if statement inside loop counter. i'm getting error 1004, , far can tell it's not letting me select in sheet. when remove "worksheets("info") bit, code works fine in sheet 1, i'm 90% sure has trying modify cell in different sheet.
any ideas?
if want work on multiple sheets need identify sheet on want run command:
with worksheets("yourfirstsheetname") if .cells(i, 6).value <> "" , .cells(i, 5).value <> "" worksheets("info").range("f5").interior.color = rgb(255, 0, 0) end if end
pay attention dots before "cells". mean command (cells...) executed on sheet named "yourfirstsheetname". instead other command executed on sheet named "info"
Comments
Post a Comment