Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HELP! Need to have earliest test record data | Excel Discussion (Misc queries) | |||
Record dates based on criteria | Excel Worksheet Functions | |||
Match the names and record the dates | Excel Programming | |||
record values from past dates | Excel Discussion (Misc queries) | |||
Code to Test Condition and Save Record to Excel | Excel Programming |