VBA to hide rows and columns

January 4, 2017 at 14:43:12
Specs: Windows 64
    Rows(Range("E54").Value + 6 & ":52").EntireRow.Hidden = True
    Columns(Range("SU1").Value + 516 & ":535").EntireColumn.Hidden = True

Hi Guys,
Having a problem with the second row of the above

E54 = 10 therefore Rows 16 - 52 are hidden
SU1 = 5 therefore Columns 521 - 535 should be hidden. However this line of code is erroring and I cannot see why. Any help would be greatly appreciated

Regards
Tony


See More: VBA to hide rows and columns

Reply ↓  Report •


#1
January 5, 2017 at 05:04:23
       col1 = Range("SU1") + 514
  
    Range(Columns(col1), Columns(533)).Select
     Selection.EntireColumn.Hidden = True

Columns(Range("SU1").Value + 516 & ":535").EntireColumn.Hidden = True

Could not get the above line of code to work, kept erroring. However the top three lines of code work perfectly, just had to change the column numbers to reflect the columns I wanted to hide

regards
Tony


Reply ↓  Report •
Related Solutions


Ask Question