Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
cappuccine
 
Posts: n/a
Default Excel Macros


I am trying to design a macro to work with a database I made in excel. I
have a lot of questions since I have never made a macro before. But I'll
just start with a simple question. I want to run a macro that will input
the current date in cell a1, then when I run the macro the next day, I
want to input the current date in cell a2. How do I set up a macro to
do that? I tried setting up a counter but I don't know how to say
something like Range(a1 + 1) = Now. So it selects the next cell down
everytime I run it. Thanks for the help in advance.

Jason


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile: http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482005

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Excel Macros

Dim iLastRow as Long

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
If iLastRow = 1 And Cells(iLastRow,"A").Value = "" Tyhen
'do nothing
Else
iLastRow = iLastRow + 1
Cells(iNextRow,"A").Value = Format(Date,"dd mmm yyyy")
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)


"cappuccine" wrote
in message ...

I am trying to design a macro to work with a database I made in excel. I
have a lot of questions since I have never made a macro before. But I'll
just start with a simple question. I want to run a macro that will input
the current date in cell a1, then when I run the macro the next day, I
want to input the current date in cell a2. How do I set up a macro to
do that? I tried setting up a counter but I don't know how to say
something like Range(a1 + 1) = Now. So it selects the next cell down
everytime I run it. Thanks for the help in advance.

Jason


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile:

http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482005



  #3   Report Post  
Roger Govier
 
Posts: n/a
Default Excel Macros

A couple of typos.
What Bob meant to type was

Dim iLastRow as Long

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
If iLastRow = 1 And Cells(iLastRow,"A").Value = "" Then
'do nothing
Else
iLastRow = iLastRow + 1
Cells(iLastRow,"A").Value = Format(Date,"dd mmm yyyy")
End If


Regards

Roger Govier


Bob Phillips wrote:
Dim iLastRow as Long

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
If iLastRow = 1 And Cells(iLastRow,"A").Value = "" Tyhen
'do nothing
Else
iLastRow = iLastRow + 1
Cells(iNextRow,"A").Value = Format(Date,"dd mmm yyyy")
End If

  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default Excel Macros

Thanks Roger, but there is a also a logic error. Should be

Dim iLastRow as Long

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
If iLastRow = 1 And Cells(iLastRow,"A").Value = "" Then
'do nothing
Else
iLastRow = iLastRow + 1
End If
Cells(iLastRow,"A").Value = Format(Date,"dd mmm yyyy")


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roger Govier" wrote in message
...
A couple of typos.
What Bob meant to type was

Dim iLastRow as Long

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
If iLastRow = 1 And Cells(iLastRow,"A").Value = "" Then
'do nothing
Else
iLastRow = iLastRow + 1
Cells(iLastRow,"A").Value = Format(Date,"dd mmm yyyy")
End If


Regards

Roger Govier


Bob Phillips wrote:
Dim iLastRow as Long

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
If iLastRow = 1 And Cells(iLastRow,"A").Value = "" Tyhen
'do nothing
Else
iLastRow = iLastRow + 1
Cells(iNextRow,"A").Value = Format(Date,"dd mmm yyyy")
End If



  #5   Report Post  
Roger Govier
 
Posts: n/a
Default Excel Macros

Hadn't spotted that one Bob<g

Regards

Roger Govier


Bob Phillips wrote:
Thanks Roger, but there is a also a logic error. Should be

Dim iLastRow as Long

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
If iLastRow = 1 And Cells(iLastRow,"A").Value = "" Then
'do nothing
Else
iLastRow = iLastRow + 1
End If
Cells(iLastRow,"A").Value = Format(Date,"dd mmm yyyy")


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
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Help for old macros with Excel 2002 Lou Excel Worksheet Functions 6 October 7th 05 06:15 AM
I deleted all macros in Excel but still get dialog box VenitaC Excel Discussion (Misc queries) 2 September 19th 05 07:05 PM
Are macros created in Excel 2003 compatible with Excel 5.0/95? Hakmui Excel Discussion (Misc queries) 1 August 31st 05 01:33 AM
How do I update Excel 2000 macros to work in Excel 2002? BobPetrich Excel Discussion (Misc queries) 3 January 4th 05 04:06 PM


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