Using VBA to Select and Highlight Excel Rows -


how can tell excel highlight rows row number. instance, let's wanted row 6, 10, 150, 201 highlighted. thanks.

here 1 based on mote's .entirerow.interior.colorindex

this 1 doesn't restrict enter row numbers gives user flexibility choose rows @ runtime.

option explicit  sub sample()     dim ret range      on error resume next     set ret = application.inputbox("please select rows color", "color rows", type:=8)     on error goto 0      if not ret nothing ret.entirerow.interior.colorindex = 6 end sub 

followup

is there way write macro read row numbers list , highlight rows?

yes there way. let's list in cell a1 a10 can use code

option explicit  sub sample()     dim long, sh worksheet      on error goto whoa      application.screenupdating = false      '~~> set sheet rows need colored     set sh = sheets("sheet2")      '~~> change sheet1 sheet has list     sheets("sheet1")         = 1 10             if not len(trim(.range("a" & i).value)) = 0 , _             isnumeric(.range("a" & i).value) _             sh.rows(.range("a" & i).value).interior.colorindex = 3 '<~~ red         next     end  letscontinue:     application.screenupdating = true     exit sub whoa:     msgbox err.description     resume letscontinue end sub 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -