Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Amend code
Hi all, The code below copies across a column from a sheet, problem is i unhides the column. How do i amend so that it copies across the colum 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! -- gavme ----------------------------------------------------------------------- gavmer's Profile: http://www.excelforum.com/member.php...nfo&userid=666 View this thread: http://www.excelforum.com/showthread.php?threadid=26189 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
amend a VB code please | Excel Discussion (Misc queries) | |||
Amend open Workbook code | Excel Programming | |||
Help on writing a code to copy and amend lines | Excel Programming | |||
Amend code or change it completely? | Excel Programming | |||
Amend form code to allow an option | Excel Programming |