Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Macro for hiding columns not worling


Using the record Macro process all I want to do is select particular
columns
to hide but when I run the Macro it hides all the columns, instead of the ones
I've selected.
In the same workbook but on a different worksheet it works fine.
The code it writes on each worksheet is different.
Do I have a setting wrong on the worksheet that not code correctly?


NOT WORKING
Sub Macro1()
'
' Hide Columns Macro
'
ActiveSheet.Unprotect
Columns("I:I").Select
Range("I3").Activate
Selection.EntireColumn.Hidden = True
End Sub

WORKING
Sub Format_to_Print_1st_Week()
'
' Format_to_Print_1st_Week Macro

ActiveSheet.Unprotect
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R").Selec t
Range("R1").Activate
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 18
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:T").S elect
Range("T1").Activate
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 32
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:AO"). Select
Range("T1").Activate
Selection.EntireColumn.Hidden = True
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 7
Rows("3:3").Select
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=21
Rows("31:31").Select
ActiveWindow.SmallScroll Down:=18
Range("31:64,65:65").Select
Range("A65").Activate
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=-57
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

thanks
Dzierzek
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Macro for hiding columns not worling

do you have any merge cells on the non-working sheet?
dzierzekr wrote:
Using the record Macro process all I want to do is select particular
columns
to hide but when I run the Macro it hides all the columns, instead of the ones
I've selected.
In the same workbook but on a different worksheet it works fine.
The code it writes on each worksheet is different.
Do I have a setting wrong on the worksheet that not code correctly?


NOT WORKING
Sub Macro1()
'
' Hide Columns Macro
'
ActiveSheet.Unprotect
Columns("I:I").Select
Range("I3").Activate
Selection.EntireColumn.Hidden = True
End Sub

WORKING
Sub Format_to_Print_1st_Week()
'
' Format_to_Print_1st_Week Macro

ActiveSheet.Unprotect
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R").Selec t
Range("R1").Activate
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 18
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:T").S elect
Range("T1").Activate
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 32
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:AO"). Select
Range("T1").Activate
Selection.EntireColumn.Hidden = True
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 7
Rows("3:3").Select
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=21
Rows("31:31").Select
ActiveWindow.SmallScroll Down:=18
Range("31:64,65:65").Select
Range("A65").Activate
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=-57
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

thanks
Dzierzek


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Macro for hiding columns not worling

YES I have one giant merged cell traveling all the
way across the top of my columns. Is this the problem
because the working sheet does not?
I don't have my spreadsheet on this machine to try it
right now.
thanks
Dzierzek


"stevebriz" wrote:

do you have any merge cells on the non-working sheet?
dzierzekr wrote:
Using the record Macro process all I want to do is select particular
columns
to hide but when I run the Macro it hides all the columns, instead of the ones
I've selected.
In the same workbook but on a different worksheet it works fine.
The code it writes on each worksheet is different.
Do I have a setting wrong on the worksheet that not code correctly?


NOT WORKING
Sub Macro1()
'
' Hide Columns Macro
'
ActiveSheet.Unprotect
Columns("I:I").Select
Range("I3").Activate
Selection.EntireColumn.Hidden = True
End Sub

WORKING
Sub Format_to_Print_1st_Week()
'
' Format_to_Print_1st_Week Macro

ActiveSheet.Unprotect
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R").Selec t
Range("R1").Activate
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 18
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:T").S elect
Range("T1").Activate
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 32
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:AO"). Select
Range("T1").Activate
Selection.EntireColumn.Hidden = True
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 7
Rows("3:3").Select
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=21
Rows("31:31").Select
ActiveWindow.SmallScroll Down:=18
Range("31:64,65:65").Select
Range("A65").Activate
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=-57
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

thanks
Dzierzek



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro for hiding columns not worling

Yes, that is the problem.

--
Regards,
Tom Ogilvy


"dzierzekr" wrote in message
...
YES I have one giant merged cell traveling all the
way across the top of my columns. Is this the problem
because the working sheet does not?
I don't have my spreadsheet on this machine to try it
right now.
thanks
Dzierzek


"stevebriz" wrote:

do you have any merge cells on the non-working sheet?
dzierzekr wrote:
Using the record Macro process all I want to do is select particular
columns
to hide but when I run the Macro it hides all the columns, instead of
the ones
I've selected.
In the same workbook but on a different worksheet it works fine.
The code it writes on each worksheet is different.
Do I have a setting wrong on the worksheet that not code
correctly?


NOT WORKING
Sub Macro1()
'
' Hide Columns Macro
'
ActiveSheet.Unprotect
Columns("I:I").Select
Range("I3").Activate
Selection.EntireColumn.Hidden = True
End Sub

WORKING
Sub Format_to_Print_1st_Week()
'
' Format_to_Print_1st_Week Macro

ActiveSheet.Unprotect
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R").Selec t
Range("R1").Activate
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 16
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 18
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:T").S elect
Range("T1").Activate
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 21
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 23
ActiveWindow.ScrollColumn = 24
ActiveWindow.ScrollColumn = 25
ActiveWindow.ScrollColumn = 26
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 28
ActiveWindow.ScrollColumn = 29
ActiveWindow.ScrollColumn = 30
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 32
Range("B:B,C:C,D:D,H:H,J:J,L:L,N:N,P:P,R:R,T:AO"). Select
Range("T1").Activate
Selection.EntireColumn.Hidden = True
ActiveWindow.ScrollColumn = 20
ActiveWindow.ScrollColumn = 19
ActiveWindow.ScrollColumn = 17
ActiveWindow.ScrollColumn = 15
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 11
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 7
Rows("3:3").Select
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=21
Rows("31:31").Select
ActiveWindow.SmallScroll Down:=18
Range("31:64,65:65").Select
Range("A65").Activate
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=-57
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

thanks
Dzierzek





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding Columns Gord Dibben Excel Discussion (Misc queries) 0 February 25th 09 08:49 PM
macro and deleting or hiding columns Pascale Excel Discussion (Misc queries) 4 March 8th 07 02:36 PM
Hiding columns without usimg a macro Mick Excel Worksheet Functions 3 January 30th 07 09:53 PM
Not Hiding Columns SS[_3_] Excel Programming 1 February 11th 04 10:27 PM
Hiding columns by Macro Michael Mitchelson[_2_] Excel Programming 1 December 2nd 03 12:22 AM


All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"