Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Selecting & Pasting Dynamic Ranges

I have a sheet with 10000 rows but this can vary. Columns
A to C always have text in all rows. I want to paste a
value from Row 2 column A to all rows in Column D. As the
number of rows can vary how can I do this with a macro
with having to manually tell it how many rows there are.

GerryM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Selecting & Pasting Dynamic Ranges

from a post of mine a few minutes ago

determine your last row with something like
lr=cells(rows.count,"a").end(xlup).row


--
Don Guillett
SalesAid Software

"GerryM" wrote in message
...
I have a sheet with 10000 rows but this can vary. Columns
A to C always have text in all rows. I want to paste a
value from Row 2 column A to all rows in Column D. As the
number of rows can vary how can I do this with a macro
with having to manually tell it how many rows there are.

GerryM



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Selecting & Pasting Dynamic Ranges

Try this:

Sub FillColD()

Dim RowCount As Long, i As Long

For i = 2 To (Cells(Rows.Count, "A").End(xlUp).Row)
Cells(i, 4).Value = Cells(2, 1).Value
Next i

End Sub


Regards,
ManualMan
http://www.gamesXL.tk

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Selecting & Pasting Dynamic Ranges

This almost works, however the cell content I want to copy
is a formula and I want to copy the formula


-----Original Message-----
Try this:

Sub FillColD()

Dim RowCount As Long, i As Long

For i = 2 To (Cells(Rows.Count, "A").End(xlUp).Row)
Cells(i, 4).Value = Cells(2, 1).Value
Next i

End Sub


Regards,
ManualMan
http://www.gamesXL.tk

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Selecting & Pasting Dynamic Ranges

Ah! Well, change the .Value attribute into .Formula
Works here!

Regards,
ManualMan
http://www.gamesXL.tk

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
Dynamic Formulas with Dynamic Ranges Ralph Howarth Excel Worksheet Functions 5 January 21st 05 08:44 AM
Selecting ranges Steve Wood Excel Programming 1 August 24th 04 02:16 PM
Selecting and pasting to an empty cell Craig from MI Excel Programming 1 March 7th 04 06:36 AM
Help - Selecting and pasting into range amonymous Excel Programming 4 January 21st 04 12:21 AM
selecting ranges MDC Excel Programming 1 July 24th 03 03:34 PM


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

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"