#1   Report Post  
Posted to microsoft.public.excel.misc
Jon Jon is offline
external usenet poster
 
Posts: 183
Default AutoFill Macro Issue

Below I have copied the macro I'm trying to build. Basically I'm having an
issue with the AutoFill area. On the original macro I had it autofill to cell
A24. That is where my data ended. The problem is that I have a different
amount of data every day. It could be A24 one day the A145 the next...etc.
How can I get this macro to autofill down to where the data stops? It will
always be in column A and the data is in column B.
Thanks, here is the macro VBS:

ActiveCell.FormulaR1C1 = "=IF(R[1]C[1]=R[2]C[1],1,0)"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A24"), Type:=xlFillDefault
Range("A1:A24").Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default AutoFill Macro Issue

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"B").end(xlup).row
.range("a1:a" & lastrow).formular1c1 _
= "=IF(R[1]C[1]=R[2]C[1],1,0)"
end with

It fills the entire range with the formula instead of using filldown or
autofill.

Jon wrote:

Below I have copied the macro I'm trying to build. Basically I'm having an
issue with the AutoFill area. On the original macro I had it autofill to cell
A24. That is where my data ended. The problem is that I have a different
amount of data every day. It could be A24 one day the A145 the next...etc.
How can I get this macro to autofill down to where the data stops? It will
always be in column A and the data is in column B.
Thanks, here is the macro VBS:

ActiveCell.FormulaR1C1 = "=IF(R[1]C[1]=R[2]C[1],1,0)"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A24"), Type:=xlFillDefault
Range("A1:A24").Select
End Sub


--

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
Autofill in macro orquidea Excel Discussion (Misc queries) 5 November 21st 07 11:20 PM
autofill issue Arain Excel Discussion (Misc queries) 0 March 28th 07 01:02 AM
autofill issue Farhad Excel Discussion (Misc queries) 0 March 28th 07 12:09 AM
Autofill macro Mike G Excel Discussion (Misc queries) 6 April 21st 05 01:33 AM
Autofill issue... nc0229 Excel Discussion (Misc queries) 0 December 13th 04 11:12 AM


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