Thread: Amend code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Amend code

Maybe you could just hide it when you're done???

right after:

fRng.EntireColumn.Copy _
Destination:=tRng

trng.entirecolumn.hidden = true

(if I picked out the correct column???)



gavmer wrote:

Hi all,

The code below copies across a column from a sheet, problem is it
unhides the column. How do i amend so that it copies across the column
but doesnt unhide it??

Private Sub ComboBox1_Change()
Dim myVal As String
Dim fRng As Range
Dim tRng As Range
Set fRng = Nothing
Set tRng = Worksheets("inclusions").Range("g1")
myVal = Worksheets("inclusions").ComboBox1.Value
Select Case myVal
Case Is = "202"
Set fRng = Worksheets("pricing").Range("e1")
Case Is = "204"
Set fRng = Worksheets("pricing").Range("f1")
Case Is = "205"
Set fRng = Worksheets("pricing").Range("g1")
Case Else
'do nothing???
End Select
If fRng Is Nothing Then
'not 704, 706, 708, 710...
'so do nothing
Else
fRng.EntireColumn.Copy _
Destination:=tRng
End If
End Sub

Cheers!!

--
gavmer
------------------------------------------------------------------------
gavmer's Profile: http://www.excelforum.com/member.php...fo&userid=6662
View this thread: http://www.excelforum.com/showthread...hreadid=261891


--

Dave Peterson