View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
chinny chinny is offline
external usenet poster
 
Posts: 9
Default Column Hidding Script not working

Afternoon Guys,

I'm trying to run a script that will hide selected columns. These columns
are selected via spreadsheet in excel. When you click on a particular cell,
it displays a column letter, eg, click "A3" as Yes, -- select column "D:D"
(results located in C1), select team 'Show Some' (located in G2). Once these
have been selected, the program will then select sheet 'Scorecard' and hide
column D:D. Please see below. It works fine when it isn't selecting a sheet
but as soon as a sheet select is placed in the script...i hides everything in
that sheet. it should hide selected columns not everything. Please help if
you can. Cheers.

Sub TestingColumn2()
Dim Columns, Hide As String

Hide = Range("H3")


If Range("G2") = Range("G2") Then
Sheets("Administration").Select
Columns = Range("C1")
Sheets("Scorecard").Select
Range("D:AS").Select
Range("A45") = ""
Selection.EntireColumn.Hidden = False
Range(Columns).Activate
Selection.EntireColumn.Hidden = Hide
Range("A45").Value = "Working"
Else
Range("A46") = "Not Working"
End If

End Sub