A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dragging values down a range using a colum to determine its length



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2010, 02:29 PM posted to microsoft.public.excel.worksheet.functions
AlexJarvis
external usenet poster
 
Posts: 6
Default Dragging values down a range using a colum to determine its length

Is is possible to write a macro that drags values (or formuals) down a column
to the length of an adjacent column, like when you double click on little
square in the right corner of the box that indicates when a cell is selected?

For this question, I need the formula or data that is in the selected cell
to repeat for all cells in the adjacent column that have values. How do I do
this?
  #2  
Old April 29th, 2010, 02:39 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Dragging values down a range using a colum to determine its length

Hi,

Assuming we have something in B1, this fills down col B as far asa there are
data in Col A

Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("B1").AutoFill Destination:=Range("B1:B" & LastRow)
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"AlexJarvis" wrote:

Is is possible to write a macro that drags values (or formuals) down a column
to the length of an adjacent column, like when you double click on little
square in the right corner of the box that indicates when a cell is selected?

For this question, I need the formula or data that is in the selected cell
to repeat for all cells in the adjacent column that have values. How do I do
this?

  #3  
Old April 29th, 2010, 02:43 PM posted to microsoft.public.excel.worksheet.functions
AlexJarvis
external usenet poster
 
Posts: 6
Default Dragging values down a range using a colum to determine its le

Wow! That was much easier than I thought it was going to be.

Thank you.

-A

"Mike H" wrote:

Hi,

Assuming we have something in B1, this fills down col B as far asa there are
data in Col A

Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("B1").AutoFill Destination:=Range("B1:B" & LastRow)
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"AlexJarvis" wrote:

Is is possible to write a macro that drags values (or formuals) down a column
to the length of an adjacent column, like when you double click on little
square in the right corner of the box that indicates when a cell is selected?

For this question, I need the formula or data that is in the selected cell
to repeat for all cells in the adjacent column that have values. How do I do
this?

  #4  
Old April 29th, 2010, 03:03 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Dragging values down a range using a colum to determine its le

Glad I could help
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"AlexJarvis" wrote:

Wow! That was much easier than I thought it was going to be.

Thank you.

-A

"Mike H" wrote:

Hi,

Assuming we have something in B1, this fills down col B as far asa there are
data in Col A

Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("B1").AutoFill Destination:=Range("B1:B" & LastRow)
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"AlexJarvis" wrote:

Is is possible to write a macro that drags values (or formuals) down a column
to the length of an adjacent column, like when you double click on little
square in the right corner of the box that indicates when a cell is selected?

For this question, I need the formula or data that is in the selected cell
to repeat for all cells in the adjacent column that have values. How do I do
this?

  #5  
Old April 29th, 2010, 04:15 PM posted to microsoft.public.excel.worksheet.functions
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Dragging values down a range using a colum to determine its length

Assumes formula is in C1 and B has the data.

Sub Auto_Fill()
Dim lRow As Long
With ActiveSheet
lRow = .Range("B" & Rows.Count).End(xlUp).Row
.Range("C1:C" & lRow).FillDown
End With
End Sub

Or if want to use selected cell then fill down.

Sub Auto_Fill()
Dim lRow As Long
With ActiveSheet
lRow = .Range("B" & Rows.Count).End(xlUp).Row
.Range(ActiveCell.Address & ":C" & lRow).FillDown
End With
End Sub



Gord Dibben MS Excel MVP

On Thu, 29 Apr 2010 06:29:02 -0700, AlexJarvis
wrote:

Is is possible to write a macro that drags values (or formuals) down a column
to the length of an adjacent column, like when you double click on little
square in the right corner of the box that indicates when a cell is selected?

For this question, I need the formula or data that is in the selected cell
to repeat for all cells in the adjacent column that have values. How do I do
this?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.