Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Test for record dates?

I am looking for code that would check for todays date in column A and if not
found put todays date in the last blank row on the sheet and then put values
of "Count1", "Count2" and "Count3" going across in the same row, columns B,C
and D. If it finds todays date do nothing.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Test for record dates?

Sub lookit()
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 1 To n
If Cells(i, "A").Value = Date Then Exit Sub
Next

For i = Rows.Count To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
With Cells(i, "A")
.Value = Date
.Offset(0, 1).Value = "Count1"
.Offset(0, 2).Value = "Count2"
.Offset(0, 3).Value = "Count3"
Exit Sub
End With
End If
Next
End Sub

If today's date is not found, the last empty row is found and the values
entered.
--
Gary''s Student - gsnu200757


"Aaron" wrote:

I am looking for code that would check for todays date in column A and if not
found put todays date in the last blank row on the sheet and then put values
of "Count1", "Count2" and "Count3" going across in the same row, columns B,C
and D. If it finds todays date do nothing.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Test for record dates?

For some reason it is going to row 65,000+ on the second part of the code.
It is not putting the date or the count in the cells?

"Gary''s Student" wrote:

Sub lookit()
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 1 To n
If Cells(i, "A").Value = Date Then Exit Sub
Next

For i = Rows.Count To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
With Cells(i, "A")
.Value = Date
.Offset(0, 1).Value = "Count1"
.Offset(0, 2).Value = "Count2"
.Offset(0, 3).Value = "Count3"
Exit Sub
End With
End If
Next
End Sub

If today's date is not found, the last empty row is found and the values
entered.
--
Gary''s Student - gsnu200757


"Aaron" wrote:

I am looking for code that would check for todays date in column A and if not
found put todays date in the last blank row on the sheet and then put values
of "Count1", "Count2" and "Count3" going across in the same row, columns B,C
and D. If it finds todays date do nothing.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Test for record dates?

You asked for the material to be put in the LAST blank row, not the FIRST
blank row. The last blank row is usually row 65536


--
Gary''s Student - gsnu200757


"Aaron" wrote:

For some reason it is going to row 65,000+ on the second part of the code.
It is not putting the date or the count in the cells?

"Gary''s Student" wrote:

Sub lookit()
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 1 To n
If Cells(i, "A").Value = Date Then Exit Sub
Next

For i = Rows.Count To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
With Cells(i, "A")
.Value = Date
.Offset(0, 1).Value = "Count1"
.Offset(0, 2).Value = "Count2"
.Offset(0, 3).Value = "Count3"
Exit Sub
End With
End If
Next
End Sub

If today's date is not found, the last empty row is found and the values
entered.
--
Gary''s Student - gsnu200757


"Aaron" wrote:

I am looking for code that would check for todays date in column A and if not
found put todays date in the last blank row on the sheet and then put values
of "Count1", "Count2" and "Count3" going across in the same row, columns B,C
and D. If it finds todays date do nothing.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Test for record dates?

Sorry, I need it for the last blank row.
Thanks in advance.

"Gary''s Student" wrote:

You asked for the material to be put in the LAST blank row, not the FIRST
blank row. The last blank row is usually row 65536


--
Gary''s Student - gsnu200757


"Aaron" wrote:

For some reason it is going to row 65,000+ on the second part of the code.
It is not putting the date or the count in the cells?

"Gary''s Student" wrote:

Sub lookit()
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 1 To n
If Cells(i, "A").Value = Date Then Exit Sub
Next

For i = Rows.Count To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
With Cells(i, "A")
.Value = Date
.Offset(0, 1).Value = "Count1"
.Offset(0, 2).Value = "Count2"
.Offset(0, 3).Value = "Count3"
Exit Sub
End With
End If
Next
End Sub

If today's date is not found, the last empty row is found and the values
entered.
--
Gary''s Student - gsnu200757


"Aaron" wrote:

I am looking for code that would check for todays date in column A and if not
found put todays date in the last blank row on the sheet and then put values
of "Count1", "Count2" and "Count3" going across in the same row, columns B,C
and D. If it finds todays date do nothing.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Test for record dates?

This is a one line change from the original solution:

Sub lookit()
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 1 To n
If Cells(i, "A").Value = Date Then Exit Sub
Next

For i = 1 To Rows.Count
If Application.CountA(Rows(i)) = 0 Then
With Cells(i, "A")
.Value = Date
.Offset(0, 1).Value = "Count1"
.Offset(0, 2).Value = "Count2"
.Offset(0, 3).Value = "Count3"
Exit Sub
End With
End If
Next
End Sub

The original started from 65536 and worked backwards looking for a blank
line. This solution starts from row #1 and works forward. The pasting will
occur near your working area rather than at the very bottom of a worksheet.
--
Gary''s Student - gsnu200757


"Aaron" wrote:

Sorry, I need it for the last blank row.
Thanks in advance.

"Gary''s Student" wrote:

You asked for the material to be put in the LAST blank row, not the FIRST
blank row. The last blank row is usually row 65536


--
Gary''s Student - gsnu200757


"Aaron" wrote:

For some reason it is going to row 65,000+ on the second part of the code.
It is not putting the date or the count in the cells?

"Gary''s Student" wrote:

Sub lookit()
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
For i = 1 To n
If Cells(i, "A").Value = Date Then Exit Sub
Next

For i = Rows.Count To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
With Cells(i, "A")
.Value = Date
.Offset(0, 1).Value = "Count1"
.Offset(0, 2).Value = "Count2"
.Offset(0, 3).Value = "Count3"
Exit Sub
End With
End If
Next
End Sub

If today's date is not found, the last empty row is found and the values
entered.
--
Gary''s Student - gsnu200757


"Aaron" wrote:

I am looking for code that would check for todays date in column A and if not
found put todays date in the last blank row on the sheet and then put values
of "Count1", "Count2" and "Count3" going across in the same row, columns B,C
and D. If it finds todays date do nothing.

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
HELP! Need to have earliest test record data Lee Excel Discussion (Misc queries) 2 July 27th 09 05:24 PM
Record dates based on criteria HappyDaddy Excel Worksheet Functions 7 August 9th 08 02:18 PM
Match the names and record the dates Tom Excel Programming 0 December 4th 06 09:34 PM
record values from past dates DMC_Chas Excel Discussion (Misc queries) 0 November 18th 06 12:14 AM
Code to Test Condition and Save Record to Excel Ken Hudson Excel Programming 0 May 25th 05 05:32 PM


All times are GMT +1. The time now is 04:06 AM.

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"