Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro - Selecting Next Available Cell


I posted this in the new users forum but figured it would probably best
be answered here.

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=482006

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Macro - Selecting Next Available Cell


Assuming everytime you run the macro you want to add a date below the
last date entered try this.

Option Explicit

Sub Test()

Dim i As Integer

i = 0
' Assuming you want the active sheet
Do While Not IsEmpty(Range("A1").Offset(i, 0))
i = i + 1
Loop
Range("A1").Offset(i, 0) = Date$

End Sub


*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro - Selecting Next Available Cell

If nothing else will be below that data, you can get the next available cell
by using

Sub placeDate()
Dim rng as Range
set rng = cells(rows.count,"A").End(xlup)
if not isempty(rng) then
' check that it isn't already there
if rng.value = date then exit sub
' it isn't the current date, so place today's
' date in the next cell
set rng = rng.offset(1,0)
end if

rng.Value = Date
End Sub

--
Regards,
Tom Ogilvy


"cappuccine" wrote
in message ...

I posted this in the new users forum but figured it would probably best
be answered here.

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=482006



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro - Selecting Next Available Cell

Just some added INFO.
this assumes you don't want to start your dates in cell A1 like you stated.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
right click the excel x just to the left of FILE on the menucopy/paste
thissave. Now, each time the file is opened excel will check the last

cell
in col A of sheet 10. Modify to suit.

Private Sub Workbook_Open()
Set x = Sheets("sheet10").Cells(Rows.Count, "a").End(xlUp).Offset(1)
If x.Offset(-1) < Date Then x.Value = Date
End Sub

--
Don Guillett
SalesAid Software

"cappuccine"

wrote
in message ...

I posted this in the new users forum but figured it would probably best
be answered here.

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=482006







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Macro - Selecting Next Available Cell

a1 is named DATES

--
Don Guillett
SalesAid Software

"Tom Ogilvy" wrote in message
...
Just some added INFO.
this assumes you don't want to start your dates in cell A1 like you

stated.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
right click the excel x just to the left of FILE on the menucopy/paste
thissave. Now, each time the file is opened excel will check the last

cell
in col A of sheet 10. Modify to suit.

Private Sub Workbook_Open()
Set x = Sheets("sheet10").Cells(Rows.Count, "a").End(xlUp).Offset(1)
If x.Offset(-1) < Date Then x.Value = Date
End Sub

--
Don Guillett
SalesAid Software

"cappuccine"

wrote
in message

...

I posted this in the new users forum but figured it would probably

best
be answered here.

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=482006







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro - Selecting Next Available Cell


Thanks! Tom's macro works great!


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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro - Selecting Next Available Cell

You must be answering in the wrong thread.

Either that or your trying to jerk us all around <g

--
Regards,
Tom Ogilvy


"Don Guillett" wrote in message
...
a1 is named DATES

--
Don Guillett
SalesAid Software

"Tom Ogilvy" wrote in message
...
Just some added INFO.
this assumes you don't want to start your dates in cell A1 like you

stated.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
right click the excel x just to the left of FILE on the

menucopy/paste
thissave. Now, each time the file is opened excel will check the last

cell
in col A of sheet 10. Modify to suit.

Private Sub Workbook_Open()
Set x = Sheets("sheet10").Cells(Rows.Count, "a").End(xlUp).Offset(1)
If x.Offset(-1) < Date Then x.Value = Date
End Sub

--
Don Guillett
SalesAid Software

"cappuccine"

wrote
in message

...

I posted this in the new users forum but figured it would probably

best
be answered here.

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=482006









  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro - Selecting Next Available Cell

Your welcome.

--
Regards,
Tom Ogilvy

"cappuccine" wrote
in message ...

Thanks! Tom's macro works great!


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

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



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Macro - Selecting Next Available Cell

But mine was shorter <boo hoo

--
Don Guillett
SalesAid Software

"cappuccine" wrote
in message ...

Thanks! Tom's macro works great!


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

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





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro - Selecting Next Available Cell


ok just to restate my next question. I am using this code for the
current date:

Sub placeDate()
Dim rng as Range
set rng = cells(rows.count,"A").End(xlup)
if not isempty(rng) then
' check that it isn't already there
if rng.value = date then exit sub
' it isn't the current date, so place today's
' date in the next cell
set rng = rng.offset(1,0)
end if

rng.Value = Date
End Sub


Now I want to ask the user what value to input into column E of the
same row as the current date. Can I add that easily in now? And how?


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

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro - Selecting Next Available Cell


Haha! Sorry, the first one I couldn't get to work. His was just next in
line to try and it worked first try.

Don Guillett Wrote:
But mine was shorter <boo hoo

--
Don Guillett
SalesAid Software

"cappuccine"
wrote
in message
...

Thanks! Tom's macro works great!


--
cappuccine

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

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

http://www.excelforum.com/showthread...hreadid=482006



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

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
Macro Pause for selecting cell jo2109 Excel Discussion (Misc queries) 3 June 4th 09 02:05 AM
macro selecting row that cursor is on (not the same cell every tim Jeremy Excel Discussion (Misc queries) 8 May 19th 08 05:09 PM
Help for Macro: Finding last cell and selecting it [email protected] Excel Discussion (Misc queries) 4 January 29th 07 08:40 AM
Macro selecting wrong cell range Josh[_10_] Excel Programming 1 June 23rd 04 06:48 PM
Macro selecting the last used cell does not work Kaj Pedersen Excel Programming 1 November 4th 03 10:25 PM


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