PC Review


Reply
Thread Tools Rate Thread

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

 
 
AlexJarvis
Guest
Posts: n/a
 
      29th Apr 2010
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?
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      29th Apr 2010
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?

 
Reply With Quote
 
AlexJarvis
Guest
Posts: n/a
 
      29th Apr 2010
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?

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      29th Apr 2010
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?

 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      29th Apr 2010
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
<(E-Mail Removed)> 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?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
determine which values in a range of cells make up a given total Sheri Beri Microsoft Excel Misc 2 19th Jan 2010 01:34 PM
Scatter PLotting using Data in third colum to determine range maugak Microsoft Excel Charting 2 29th Jul 2009 03:34 PM
Query to determine individual values within a range mpdsal via AccessMonster.com Microsoft Access Forms 1 3rd Nov 2006 08:36 PM
Can I program Colum B to record a range based on a values in colum =?Utf-8?B?Tmlrb2xl?= Microsoft Frontpage 1 17th Aug 2005 03:15 PM
lookup in colum a and compare values in colum b =?Utf-8?B?Qm9nZ2xlZCBFeGNlbCBVc2Vy?= Microsoft Excel Worksheet Functions 14 29th Oct 2004 06:38 PM


Features
 

Advertising
 

Newsgroups
 


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