Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default How to transfer the length of one column to a formula in Visual ba

I have a column A of variable length (say 100 cells). I have a formula in J2
which I wish to pull down for that number of cells.

Range ("J2").Select
Selection.Autofill Destination:=Range("J2:J101"), Type:=xlFillDefault.

How do I get the length of Column A to replace the term 'J101' in this
formula?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default How to transfer the length of one column to a formula in Visual ba


Selection.AutoFill Destination:=Range("j2:j"
&ActiveSheet.UsedRange.Rows.Count)
"Kanga 85" wrote:

I have a column A of variable length (say 100 cells). I have a formula in J2
which I wish to pull down for that number of cells.

Range ("J2").Select
Selection.Autofill Destination:=Range("J2:J101"), Type:=xlFillDefault.

How do I get the length of Column A to replace the term 'J101' in this
formula?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default How to transfer the length of one column to a formula in Visua

Thanks.
This works alright except that I have further data in cells J102-J106 which
now get overwritten. I only want to fill the cells in Column J which
correspond to the number of cells I have in Column A, no more and no less.

"DMoney" wrote:


Selection.AutoFill Destination:=Range("j2:j"
&ActiveSheet.UsedRange.Rows.Count)
"Kanga 85" wrote:

I have a column A of variable length (say 100 cells). I have a formula in J2
which I wish to pull down for that number of cells.

Range ("J2").Select
Selection.Autofill Destination:=Range("J2:J101"), Type:=xlFillDefault.

How do I get the length of Column A to replace the term 'J101' in this
formula?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default How to transfer the length of one column to a formula in Visual ba

dim LastRow as long

with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("j2").autofill _
destination:=.range("J2:J" & lastrow), type:=xlfilldefault
end with



Kanga 85 wrote:

I have a column A of variable length (say 100 cells). I have a formula in J2
which I wish to pull down for that number of cells.

Range ("J2").Select
Selection.Autofill Destination:=Range("J2:J101"), Type:=xlFillDefault.

How do I get the length of Column A to replace the term 'J101' in this
formula?

Thanks


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default How to transfer the length of one column to a formula in Visua

Thanks Dave; running well

"Dave Peterson" wrote:

dim LastRow as long

with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("j2").autofill _
destination:=.range("J2:J" & lastrow), type:=xlfilldefault
end with



Kanga 85 wrote:

I have a column A of variable length (say 100 cells). I have a formula in J2
which I wish to pull down for that number of cells.

Range ("J2").Select
Selection.Autofill Destination:=Range("J2:J101"), Type:=xlFillDefault.

How do I get the length of Column A to replace the term 'J101' in this
formula?

Thanks


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default How to transfer the length of one column to a formula in Visual ba

Here's a slightly different approach similar to Dave's excellent idea.

Sub Demo()
With Range([A2], Cells(Rows.Count, "A").End(xlUp))
[J2].Resize(.Rows.Count).FillDown
End With
End Sub

--
Dana DeLouis
Win XP & Office 2003


"Kanga 85" wrote in message
...
I have a column A of variable length (say 100 cells). I have a formula in
J2
which I wish to pull down for that number of cells.

Range ("J2").Select
Selection.Autofill Destination:=Range("J2:J101"), Type:=xlFillDefault.

How do I get the length of Column A to replace the term 'J101' in this
formula?

Thanks



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
need formula: # entered in column B will transfer to column D JENAB Excel Worksheet Functions 5 November 1st 08 05:11 AM
Is there a formula to transfer the last value in a column Tam Excel Worksheet Functions 2 September 18th 07 09:24 PM
add numbers in a column and transfer result to another column planecents Excel Worksheet Functions 3 March 2nd 07 06:05 PM
automate column length wsk Excel Discussion (Misc queries) 1 May 13th 06 12:31 PM
Length of Used Column Alec Excel Programming 2 October 21st 03 03:52 PM


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

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"