Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Simple code entering data

Hi,

I hope I can get some help on this one.

I am looking to do something really simple.

I need to track contacts on a daily basis.

What I want to have is a list starting at Row 4 column AA.
Each row will consist of one colum with the date (ie 2007/03/25) and
the second column the number of contacts for that day.

I want to have a button that basically increases the contacts by one
every time it is clicked.

I can create the worksheet and do all I want to do but its the coding
that messes me up. :)
When the button is clicked it needs to do the following:

Find the first empty row starting at R4ColAA.
Find the last row with a date entry starting at R4ColAA.
If it is todays date then increase ColAB by 1.

If it is not todays date then go to next row, add todays date on Col
AA and inc col AB by one.


Thats it, I know it is a pretty simple code, and any help would be
appreciated.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Simple code entering data

Public Sub CommandButton1_click()
Dim iLastRow As Long
iLastRow = Cells(Rows.Count, "AA").End(xlUp).Row
If Cells(iLastRow, "AA").Value < Date Then
iLastRow = iLastRow + 1
End If
Cells(iLastRow, "AA").Value = Date
Cells(iLastRow, "AB").Value = Cells(iLastRow, "AB").Value + 1

End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



wrote in message
oups.com...
Hi,

I hope I can get some help on this one.

I am looking to do something really simple.

I need to track contacts on a daily basis.

What I want to have is a list starting at Row 4 column AA.
Each row will consist of one colum with the date (ie 2007/03/25) and
the second column the number of contacts for that day.

I want to have a button that basically increases the contacts by one
every time it is clicked.

I can create the worksheet and do all I want to do but its the coding
that messes me up. :)
When the button is clicked it needs to do the following:

Find the first empty row starting at R4ColAA.
Find the last row with a date entry starting at R4ColAA.
If it is todays date then increase ColAB by 1.

If it is not todays date then go to next row, add todays date on Col
AA and inc col AB by one.


Thats it, I know it is a pretty simple code, and any help would be
appreciated.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Simple code entering data

Thanks for the quick reply.

Its good, but how do I check if iLastRow has todays date?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Simple code entering data

On Mar 25, 4:10 pm, wrote:
Thanks for the quick reply.

Its good, but how do I check if iLastRow has todays date?

Thanks


Duhhh!!!

Just Date to compare...

Thanks for all the help, problem has been solved...

Cheers.

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
Sometimes entering simple function causes it to occupy two cells, why? [email protected] Excel Worksheet Functions 2 November 29th 06 06:37 PM
Simple code to append numbers to the existing data in the cells Hemang Shah Excel Programming 1 June 23rd 06 06:02 AM
Prolblem entering simple Formulae Andy Excel Discussion (Misc queries) 2 June 14th 06 11:21 AM
Code for entering time - trying again Denise Excel Discussion (Misc queries) 4 September 29th 05 08:37 PM
Code for entering time Denise Excel Discussion (Misc queries) 6 September 29th 05 08:15 PM


All times are GMT +1. The time now is 01:28 AM.

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"