![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 26
|
Hi,
I am trying to hide 2 columns when i hide it without macro it only selects the 2 columns which i selected but when i run it with macro it selects all the columns and hides everything. It must be doing it because i have merge fields at the top of the sheet. but why does it not do that outside of macro? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
Hi ap1,
This is just one of many examples of recorded code that does not do the same thing as the manual operations that were recorded. Recording is a handy feature, but occasionally one must actually write the VBA code manually to get it to do what you want. Usually the result of writing the code manually is also much cleaner, more efficient code, as is the case in this instance. You should be able to change your code to (this example just for hiding column D): Columns(4).Hidden = True
__________________
Keep Excelling. Damon VBAexpert Excel Consulting (My other life: http://damonostrander.com ) |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 26
|
Thanks. Appreciate your response.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|