Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill and programming -- I'm SO confused -- please help!

hi

I get a spreadsheet in once a day that has weird dates on it
& they need to be today's date. I've figured out how to do a
macro and save it to a button... but...

I recorded a macro yesterday.. this is what came out

Range("F2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F1001")
Range("F2:F1001").Select


and I did the same thing today... (forgetting that I'd done it yesterday)

and this is what came out

Range("F2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F998")
Range("F2:F998").Select


I just want it to do the whole of the F column -- well, not the whole, just
the
values that already exist - and overwrite it with today() -- why does
it put in a fixed range? and more to the point... how do I get it not to?

or is there another way to do it?

please help!

thanks

-JB


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Autofill and programming -- I'm SO confused -- please help!

It puts in what you did that time. (How would xl guess that sometimes I mean
row 998 and sometimes it meant I wanted the used cells in that column?)

but you could do something like:

dim LastCell as range
with activesheet
set lastcell = .cells(.rows.count,"F").end(xlup)
.range("F2").formula = "=today()"
.range("F2").autofill _
destination:=.range("f2",lastcell)
.range("F2",lastcell).select
end with

Alternatively, you could plop that =today() formula in the whole range in one
plop:

Dim LastCell As Range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "F").End(xlUp)
.Range("F2", LastCell).Formula = "=today()"
End With





John wrote:

hi

I get a spreadsheet in once a day that has weird dates on it
& they need to be today's date. I've figured out how to do a
macro and save it to a button... but...

I recorded a macro yesterday.. this is what came out

Range("F2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F1001")
Range("F2:F1001").Select

and I did the same thing today... (forgetting that I'd done it yesterday)

and this is what came out

Range("F2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F998")
Range("F2:F998").Select

I just want it to do the whole of the F column -- well, not the whole, just
the
values that already exist - and overwrite it with today() -- why does
it put in a fixed range? and more to the point... how do I get it not to?

or is there another way to do it?

please help!

thanks

-JB


--

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
:S confused :S Laura \( '_' \) Excel Discussion (Misc queries) 1 November 15th 05 01:44 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM
Date programming - Absolutely confused. Malycom Excel Programming 3 June 17th 04 02:11 PM
confused... keepitcool Excel Programming 0 September 22nd 03 09:29 AM


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

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

About Us

"It's about Microsoft Excel"