Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Tony P.
 
Posts: n/a
Default Excel VB-Copy formula down until adjacent cell (left) is blank?

Here is exactly what I am trying to do through VB in Excel:

Weekly data pull fills colums A:G. Row count is always different. I am
modifying the data pull through VB, and I have a VLOOKUP formula in cell H2.
What I want VB to do is copy that formula down column H to the last row (with
data) each week. I guess I want it to be dynamic so that as rows
decrease/increase the formula is only copied down to the final row/record.

I know someone out of this smart group will know how to do this!

Thanks in advance!

Tony


  #2   Report Post  
TomHinkle
 
Posts: n/a
Default

(pseudo code)

in a macro
....

dim lngLastrow as long
dim rngTargetStart as range
dim rngTargetEnd as range


' finds the LAST row of data to go to
lnglastrow = worksheet(x).range("A65536").end(xlup).cells(2,1). row

set rngTargetstart = worksheet(x).range("H2") ' for my example, the
formula is stored in H1
set rngTargetEnd = worksheet(x).cells(lngLastRow,8) ' last row, column H

worksheet(x).range("H1").copy range(rngTargetStart,rngTargetEnd)

' clean up object variables.








"Tony P." wrote:

Here is exactly what I am trying to do through VB in Excel:

Weekly data pull fills colums A:G. Row count is always different. I am
modifying the data pull through VB, and I have a VLOOKUP formula in cell H2.
What I want VB to do is copy that formula down column H to the last row (with
data) each week. I guess I want it to be dynamic so that as rows
decrease/increase the formula is only copied down to the final row/record.

I know someone out of this smart group will know how to do this!

Thanks in advance!

Tony


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
Copy cell formula help tamato43 Excel Discussion (Misc queries) 2 March 31st 05 12:55 AM
Can I copy a combo box in Excel 2002 with a relative cell link? Bozo Excel Discussion (Misc queries) 1 February 17th 05 03:05 AM
excel tab key to move to right adjacent cell dwillie Excel Discussion (Misc queries) 2 January 26th 05 09:01 PM
how do i copy formula and change worksheet instead of cell dal0506 Excel Worksheet Functions 2 January 21st 05 09:41 PM
How do I copy Tab into a single cell in Excel? bryantebbe Excel Discussion (Misc queries) 3 January 20th 05 01:58 AM


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