LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Set the copy to column to a variable

Hi Claus,

I found my mistakes, seeks I was using improper sheet naming conventions with in this With statement. I was not including Sheets(MySheet). where needed.

Seems to work fine now.


With Sheets(MySheet)

myFirst = Sheets(MySheet).Columns("A").Column
myLast = Sheets(MySheet).Columns("C").Column
ReDim Preserve varRows(myLast - myFirst)


' Finds the row number of the longest column between A and C
For i = myFirst To myLast
varRows(i - myFirst) = Sheets(MySheet).Cells(Rows.Count, i).End(xlUp).Row
Next


Set aScan = Sheets(MySheet).Range("A3:C" & Application.Max(varRows)).Find(cScan, LookAt:=xlWhole)


If Not aScan Is Nothing Then

myCol = Application.Match(MySheet, Sheets("FBAout").Range("1:1"), 0)
ActiveWindow.ScrollColumn = myCol

Set dest = Sheets("FBAout").Cells(Rows.Count, myCol).End(xlUp)(2)
dest.Offset(0, 1) = Date
aScan.Cut dest

Else
MsgBox " No match found."

End If

End With

Howard


 
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
How do I pull variable URL from one column and download the contentto another column? pand0ra.usa Excel Programming 3 August 26th 09 11:38 PM
Copy variable sized range to single column... Jed Excel Programming 1 February 22nd 07 06:31 AM
copy a range with known start column to variable end column Matilda Excel Programming 2 August 2nd 06 04:55 PM
Offset from a variable column to a fixed column Kurt Barr Excel Programming 2 June 27th 06 05:45 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM


All times are GMT +1. The time now is 06:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"