Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Acct Supr - DCTC
 
Posts: n/a
Default Copy cells to variable number of rows

I need to copy a formula (that a macro has entered at W3 & X3) down to the
last row for that particuliar wk. I've figured out how to get the number of
rows for that wk( in this case i=93, i will change for each wk) but can't
figure out the syntax for the Range:

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste
  #2   Report Post  
Duke Carey
 
Posts: n/a
Default Copy cells to variable number of rows

instead of

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

try

range("W4:W"&i).filldown


"Acct Supr - DCTC" wrote:

I need to copy a formula (that a macro has entered at W3 & X3) down to the
last row for that particuliar wk. I've figured out how to get the number of
rows for that wk( in this case i=93, i will change for each wk) but can't
figure out the syntax for the Range:

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

  #3   Report Post  
Acct Supr - DCTC
 
Posts: n/a
Default Copy cells to variable number of rows

The .filldown didn't seem to work for me (likely something in the way I set
things up) but when I put Select in its place it worked just the way I
wanted. Thanks for the help. Do you know of a good book or class that help
me getting better at writing Macros?

"Duke Carey" wrote:

instead of

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

try

range("W4:W"&i).filldown


"Acct Supr - DCTC" wrote:

I need to copy a formula (that a macro has entered at W3 & X3) down to the
last row for that particuliar wk. I've figured out how to get the number of
rows for that wk( in this case i=93, i will change for each wk) but can't
figure out the syntax for the Range:

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

  #4   Report Post  
Duke Carey
 
Posts: n/a
Default Copy cells to variable number of rows

I haven't the experience with many Excel books in the last 5 years. Some
people here have recommended John Walkenbach's books. You can read reviews
at Amazon on Excel VBA books - there are lots of books to choose from.

"Acct Supr - DCTC" wrote:

The .filldown didn't seem to work for me (likely something in the way I set
things up) but when I put Select in its place it worked just the way I
wanted. Thanks for the help. Do you know of a good book or class that help
me getting better at writing Macros?

"Duke Carey" wrote:

instead of

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

try

range("W4:W"&i).filldown


"Acct Supr - DCTC" wrote:

I need to copy a formula (that a macro has entered at W3 & X3) down to the
last row for that particuliar wk. I've figured out how to get the number of
rows for that wk( in this case i=93, i will change for each wk) but can't
figure out the syntax for the Range:

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default Copy cells to variable number of rows

Duke - How can I do the same where W4 will always be variable. I've based the
formula to find last active cell using another row, but I'm not sure how to
make the formula in the last active cell to copy to the end last active cell
based on the other row.
--
DanaK


"Duke Carey" wrote:

instead of

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

try

range("W4:W"&i).filldown


"Acct Supr - DCTC" wrote:

I need to copy a formula (that a macro has entered at W3 & X3) down to the
last row for that particuliar wk. I've figured out how to get the number of
rows for that wk( in this case i=93, i will change for each wk) but can't
figure out the syntax for the Range:

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Copy cells to variable number of rows

Maybe...


Dim LastRow as long
dim TopCell as range
with worksheets("sheetnamehere")
set topcell = .range("W4") 'or however you set that variable
'I used column X to get that last row
lastrow = .cells(.rows.count,"X").end(xlup).row
.range(topcell,.cells(lastrow,topcell.column)).fil ldown
end with




DanaK wrote:

Duke - How can I do the same where W4 will always be variable. I've based the
formula to find last active cell using another row, but I'm not sure how to
make the formula in the last active cell to copy to the end last active cell
based on the other row.
--
DanaK

"Duke Carey" wrote:

instead of

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste

try

range("W4:W"&i).filldown


"Acct Supr - DCTC" wrote:

I need to copy a formula (that a macro has entered at W3 & X3) down to the
last row for that particuliar wk. I've figured out how to get the number of
rows for that wk( in this case i=93, i will change for each wk) but can't
figure out the syntax for the Range:

Selection.Copy
Range("W4: ? ").Select
ActiveSheet.Paste


--

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
how to count the number of text frequencies and copy to other cell DG Excel Worksheet Functions 1 October 6th 05 07:11 PM
copy & paste spreadsheet cells from excel to outlook to excel mismarple Excel Discussion (Misc queries) 1 September 20th 05 11:16 PM
Creating a macros to copy and paste cells Karin Schmidt Excel Discussion (Misc queries) 1 August 4th 05 07:07 PM
copy exact values from RangeA to Range B which has extra rows guptasa@gossami .com Excel Discussion (Misc queries) 1 May 16th 05 09:21 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 12:12 AM.

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"