excel vba

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft VBA Training and help » Excel VBA

Excel VBA

resolvedResolved · High Priority · Version 2007

Cyrus has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

Excel VBA

Hi, could anyone help me with VBA code for hiding columns in a workbook with 10 various worksheet?

For example, sheet 1, hide column G:G, K:K, & M:M
Sheet 2 hide column B:B, F:F, H:H

and the columns varies per each worksheet.

The purpose is to have a printable with with the remaining data.

Thanks
Cy

RE: Excel VBA

Hi Cyrus, thanks for your query. It's going to look a lot like this:

Range("G:G,K:K,M:M").Select
Selection.EntireColumn.Hidden = True

...for each sheet you need.

Hope this helps,

Anthony

Fri 2 Mar 2012: Automatically marked as resolved.


 

VBA tip:

Use GoTo to Select A Cell With VBA

To select a certain cell on a Worksheet you can use:

Application.Goto Reference:=Range("V300")

or more simply

Range("V300").Select

If, on the other hand, you want the selected cell to be the top/left cell on the screen you use:

Application.Goto Reference:=Range("V300"), Scroll=True

View all VBA hints and tips


Server loaded in 0.11 secs.