View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
crazybass2 crazybass2 is offline
external usenet poster
 
Posts: 167
Default Unhide Columns in certain range

Place this code in the module for the sheet in question.

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Not Intersect(Target, Range("D3:BD3")) Is Nothing Then
For Each rng In Range("D3:BD3")
If rng < "" Then Columns(rng.Column).Hidden = False
Next rng
End If
End Sub


Mike

"Desert Piranha" wrote:


Hi all,

I have columns D through BD where data is pasted from another workbook,
one column per week (via code).

So unused columns on the right are hidden. They are not completly
unused as there are rows with formulas..

Based on row 3 I am trying to:
When the data (for this week as example) is pasted in then that coulmn
will be unhidden.

I am trying to change the 'End(xlToLeft)" to work with 'Columns D
through BD' only.
Cells(3, Columns.Count).End(xlToLeft).Offset(0, 1).EntireColumn.Hidden
= False

I can't use that, because columns to the right, BE through BF have data
and that is blocking.

Any direction is surely appreciated.


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=560574