Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Yes, another variable range question....

I've searched & searched but can't figure this one out. I have a macro where
I need to find the last active cell (based on column A) and have placed a
formula in E at that cell. I need to copy that formula down to the last
active row based on D or G. Then I will need to copy & paste the value of E
over D. The last active cell will of course always be variable as will the
last row. I've used every bit of 'stolen' code & can't seen to modify it to
do what I need, or much of anything really. Help?

A B C D E
F G
127100 1431000 -205.74 TU17306
127100 1431000 272.77 TU17306
127100 1431000 -236.38 TU17437
127100 1431000 244.11 TU17437
858.73 =SUM(D727*-1) DO60840
448.04 DO60858
-2.14 DO60932
-11.08 DO60982
-21.00 DO61039
49.24 DO61309
-2.23 DO61337


--
DanaK
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Yes, another variable range question....

Try soemting like this. I not sure what the formula is. I don't know what
row 727 is nor the star. I guessed what you wanted. Modify as required.

LastRow = Range("A" & Rows.Count).end(xlup).row
FirstRow = LastRow + 1
LastRow = Range("D" & Rows.Count).end(xlup).row
LastRowG = Range("G" & Rows.Count).end(xlup).row
if LastRowG LastRow then
LastRow = LastrowG
end if

columns("D").Insert

Range("D" & FirstRow).formula = _
"=SUM(D" & (Firstrow - 1) & "-1)"
Set CopyRange = Range(Range("D" & FirstRow),Range("D" & LastRow))
Range("D" & FirstRow).copy _
Destination:=CopyRange




"DanaK" wrote:

I've searched & searched but can't figure this one out. I have a macro where
I need to find the last active cell (based on column A) and have placed a
formula in E at that cell. I need to copy that formula down to the last
active row based on D or G. Then I will need to copy & paste the value of E
over D. The last active cell will of course always be variable as will the
last row. I've used every bit of 'stolen' code & can't seen to modify it to
do what I need, or much of anything really. Help?

A B C D E
F G
127100 1431000 -205.74 TU17306
127100 1431000 272.77 TU17306
127100 1431000 -236.38 TU17437
127100 1431000 244.11 TU17437
858.73 =SUM(D727*-1) DO60840
448.04 DO60858
-2.14 DO60932
-11.08 DO60982
-21.00 DO61039
49.24 DO61309
-2.23 DO61337


--
DanaK

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
Range to VLOOKUP as a Variable (range in another file) LuisE Excel Programming 3 December 2nd 07 03:22 PM
Variable range question papadoc Excel Programming 3 July 19th 06 04:04 AM
Macro to copy a specified range to a variable range SWT Excel Programming 4 October 21st 05 08:24 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


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