Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dynamic Formulas with Dynamic Ranges | Excel Worksheet Functions | |||
Selecting ranges | Excel Programming | |||
Selecting and pasting to an empty cell | Excel Programming | |||
Help - Selecting and pasting into range | Excel Programming | |||
selecting ranges | Excel Programming |