#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

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
amend a VB code please Morgan Excel Discussion (Misc queries) 0 March 3rd 10 11:17 PM
Amend open Workbook code Stuart[_5_] Excel Programming 3 February 7th 04 04:55 PM
Help on writing a code to copy and amend lines Karen Brown[_2_] Excel Programming 2 February 5th 04 05:51 PM
Amend code or change it completely? Gareth[_3_] Excel Programming 2 December 1st 03 07:24 PM
Amend form code to allow an option Stuart[_5_] Excel Programming 3 October 23rd 03 08:11 PM


All times are GMT +1. The time now is 08:25 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"