I set up a macro to hide/unhide columns. It hides more columns

L

Lori

It is supposed to hide column J, copy column I, paste special (values) to
column J and re-hide column J. It does all that AND THEN hides columns G
through L instead of just J. I I have no idea how to correct.. Help... Lori
Sub Test()
'
' Test Macro
' Macro recorded 9/6/2006 by LORI MILLER
'
' Keyboard Shortcut: Ctrl+a
'
Columns("I:K").Select
Selection.EntireColumn.Hidden = False
Range("I11:I34").Select
Selection.Copy
Range("J11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

'Hide Column J

Columns("J:J").Select

Selection.EntireColumn.Hidden = True

End Sub
 
J

Jim Thomlinson

So long as you avoid the selects there is no need to unhide and hide.
Something like this...

Sub Test()
'
' Test Macro
' Macro recorded 9/6/2006 by LORI MILLER
'
' Keyboard Shortcut: Ctrl+a
'
Range("I11:I34").Copy
Range("J11").PasteSpecial Paste:=xlPasteValues
Application.cutcopymode = false
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top