Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Don't Copy If Null -- Help

I have generated a code with help of macro's that will select a range
and then Auto fills it to a given range. It all works fine with one
exception. What I really like to do is stop copying the formula if
there is no values in Column A, in other word do copy until cell in
Column A is Null, Starting from A3.

Range("C2:BL2").Select
Selection.AutoFill Destination:=Range("C2:BL43"),
Type:=xlFillDefault
Range("C2:BL43").Select

A B C D E F Etc -----------
1 NAME Formula Formula Formula
2 Name


Ardy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Don't Copy If Null -- Help

Can you start at the bottom of column A and come up to find that last used cell?

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("c2:bl2").autofill destination:=.range("c2:bl" & lastrow), _
type:=xlfilldefault
end with

Ardy wrote:

I have generated a code with help of macro's that will select a range
and then Auto fills it to a given range. It all works fine with one
exception. What I really like to do is stop copying the formula if
there is no values in Column A, in other word do copy until cell in
Column A is Null, Starting from A3.

Range("C2:BL2").Select
Selection.AutoFill Destination:=Range("C2:BL43"),
Type:=xlFillDefault
Range("C2:BL43").Select

A B C D E F Etc -----------
1 NAME Formula Formula Formula
2 Name

Ardy


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Don't Copy If Null -- Help

Peter:

The Problem is that I am inserting the first row of the formula to
transfer some data points from other Tabs to C2:BL2 , Then Copying via
Auto fill from C3:BL3 until I see a Null in Column A Starting from A3,
So I really need to start from top until I see Null In Column A then
Stop

Sorry I responded late X-mas Stuff.....

Ardy

Dave Peterson wrote:
Can you start at the bottom of column A and come up to find that last used cell?

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("c2:bl2").autofill destination:=.range("c2:bl" & lastrow), _
type:=xlfilldefault
end with

Ardy wrote:

I have generated a code with help of macro's that will select a range
and then Auto fills it to a given range. It all works fine with one
exception. What I really like to do is stop copying the formula if
there is no values in Column A, in other word do copy until cell in
Column A is Null, Starting from A3.

Range("C2:BL2").Select
Selection.AutoFill Destination:=Range("C2:BL43"),
Type:=xlFillDefault
Range("C2:BL43").Select

A B C D E F Etc -----------
1 NAME Formula Formula Formula
2 Name

Ardy


--

Dave Peterson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Don't Copy If Null -- Help

Maybe you could use:

lastrow = .cells(1,"A").end(xldown).row



Ardy wrote:

Peter:

The Problem is that I am inserting the first row of the formula to
transfer some data points from other Tabs to C2:BL2 , Then Copying via
Auto fill from C3:BL3 until I see a Null in Column A Starting from A3,
So I really need to start from top until I see Null In Column A then
Stop

Sorry I responded late X-mas Stuff.....

Ardy

Dave Peterson wrote:
Can you start at the bottom of column A and come up to find that last used cell?

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("c2:bl2").autofill destination:=.range("c2:bl" & lastrow), _
type:=xlfilldefault
end with

Ardy wrote:

I have generated a code with help of macro's that will select a range
and then Auto fills it to a given range. It all works fine with one
exception. What I really like to do is stop copying the formula if
there is no values in Column A, in other word do copy until cell in
Column A is Null, Starting from A3.

Range("C2:BL2").Select
Selection.AutoFill Destination:=Range("C2:BL43"),
Type:=xlFillDefault
Range("C2:BL43").Select

A B C D E F Etc -----------
1 NAME Formula Formula Formula
2 Name

Ardy


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Don't Copy If Null -- Help

Peter:
I am Sorry...... IIt works just as same from the bottom, I didn't
think It Would. This was so Easy...

Thanks
Ardy wrote:
Peter:

The Problem is that I am inserting the first row of the formula to
transfer some data points from other Tabs to C2:BL2 , Then Copying via
Auto fill from C3:BL3 until I see a Null in Column A Starting from A3,
So I really need to start from top until I see Null In Column A then
Stop

Sorry I responded late X-mas Stuff.....

Ardy

Dave Peterson wrote:
Can you start at the bottom of column A and come up to find that last used cell?

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("c2:bl2").autofill destination:=.range("c2:bl" & lastrow), _
type:=xlfilldefault
end with

Ardy wrote:

I have generated a code with help of macro's that will select a range
and then Auto fills it to a given range. It all works fine with one
exception. What I really like to do is stop copying the formula if
there is no values in Column A, in other word do copy until cell in
Column A is Null, Starting from A3.

Range("C2:BL2").Select
Selection.AutoFill Destination:=Range("C2:BL43"),
Type:=xlFillDefault
Range("C2:BL43").Select

A B C D E F Etc -----------
1 NAME Formula Formula Formula
2 Name

Ardy


--

Dave Peterson




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Don't Copy If Null -- Help

Dave.

Ardy wrote:

Peter:
I am Sorry...... IIt works just as same from the bottom, I didn't
think It Would. This was so Easy...

Thanks
Ardy wrote:
Peter:

The Problem is that I am inserting the first row of the formula to
transfer some data points from other Tabs to C2:BL2 , Then Copying via
Auto fill from C3:BL3 until I see a Null in Column A Starting from A3,
So I really need to start from top until I see Null In Column A then
Stop

Sorry I responded late X-mas Stuff.....

Ardy

Dave Peterson wrote:
Can you start at the bottom of column A and come up to find that last used cell?

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("c2:bl2").autofill destination:=.range("c2:bl" & lastrow), _
type:=xlfilldefault
end with

Ardy wrote:

I have generated a code with help of macro's that will select a range
and then Auto fills it to a given range. It all works fine with one
exception. What I really like to do is stop copying the formula if
there is no values in Column A, in other word do copy until cell in
Column A is Null, Starting from A3.

Range("C2:BL2").Select
Selection.AutoFill Destination:=Range("C2:BL43"),
Type:=xlFillDefault
Range("C2:BL43").Select

A B C D E F Etc -----------
1 NAME Formula Formula Formula
2 Name

Ardy

--

Dave Peterson


--

Dave Peterson
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
Failed to save table attributes of (null) into (null). Luca Brasi Excel Discussion (Misc queries) 2 February 4th 09 04:30 PM
COUNTIF says Null = Blank but Blank < Null Epinn Excel Worksheet Functions 4 October 25th 06 08:03 PM
Null, "null", vbNull, vbNullString, vbEmpty [email protected] Excel Programming 2 July 25th 06 01:28 PM
Copy contents of Cell to array based on Col1 value not null missleigh[_2_] Excel Programming 0 April 12th 06 10:13 PM
copy cell with non null value tommy_gtr[_7_] Excel Programming 20 October 14th 05 08:02 AM


All times are GMT +1. The time now is 12:55 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"