![]() |
Populating Cells in a row.
I am using this code to put the value of EPLCRef1TextBox & "-"
EPLCRef2TextBox into the next empty cell in column "C" starting at Ro 10. Private Sub AuditDetailsCompleteCommandButton_Click() With Worksheets("DUMP") Application.ScreenUpdating = False Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Select If Selection.Row < 10 Then Range("A10").Select ActiveCell.Value = EPLCRef1TextBox & "-" & EPLCRef2TextBox End With Application.ScreenUpdating = True End Sub I then want to add the contents of UseThis1TextBox to the next cell o the Right and todays Date into the cell next to that. I also want to ad a few more TextBox Values to the right of this. Can someone please tell me how to do this in VBA. Cheer -- Message posted from http://www.ExcelForum.com |
Populating Cells in a row.
Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Select
If Selection.Row < 10 Then Range("A10").Select ActiveCell.Value = EPLCRef1TextBox & "-" & EPLCRef2TextBox End With ActiveCell.Offset(0,1).Value = UseThis1TextBox.Text ActiveCell.Offset(0,2).Value = Date Application.ScreenUpdating = True End Sub -- Regards, Tom Ogilvy "Jako " wrote in message ... I am using this code to put the value of EPLCRef1TextBox & "-" & EPLCRef2TextBox into the next empty cell in column "C" starting at Row 10. Private Sub AuditDetailsCompleteCommandButton_Click() With Worksheets("DUMP") Application.ScreenUpdating = False Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Select If Selection.Row < 10 Then Range("A10").Select ActiveCell.Value = EPLCRef1TextBox & "-" & EPLCRef2TextBox End With Application.ScreenUpdating = True End Sub I then want to add the contents of UseThis1TextBox to the next cell on the Right and todays Date into the cell next to that. I also want to add a few more TextBox Values to the right of this. Can someone please tell me how to do this in VBA. Cheers --- Message posted from http://www.ExcelForum.com/ |
Populating Cells in a row.
Thanks Tom , Only trouble is that the date is mm/dd/yy.
So todays date read 08/01/04, what i want it to read is 01/07/2004. I have tried =format(date, "dd/mm/yyyy" but to no avail, Excel seem to insist that i use mm-dd-yy !! Any ideas -- Message posted from http://www.ExcelForum.com |
Populating Cells in a row.
DOH !! sorry of course i meant 01/08/2004 not 01/07/2004.
Cheer -- Message posted from http://www.ExcelForum.com |
Populating Cells in a row.
Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Select
If Selection.Row < 10 Then Range("A10").Select ActiveCell.Value = EPLCRef1TextBox & "-" & EPLCRef2TextBox End With ActiveCell.Offset(0,1).Value = UseThis1TextBox.Text ActiveCell.Offset(0,2).Value = Date ActiveCell.Offset(0,2).NumberFormat = "dd/mm/yyyy" Application.ScreenUpdating = True End Sub -- Regards, Tom Ogilvy "Jako " wrote in message ... DOH !! sorry of course i meant 01/08/2004 not 01/07/2004. Cheers --- Message posted from http://www.ExcelForum.com/ |
Populating Cells in a row.
After you populate the cell, give it the numberformat you want:
ActiveCell.Offset(0,2).Value = Date ActiveCell.Offset(0,2).numberformat = "dd/mm/yyyy" or with ActiveCell.Offset(0,2) .Value = Date .numberformat = "dd/mm/yyyy" end with (to save your fingers) "Jako <" wrote: Thanks Tom , Only trouble is that the date is mm/dd/yy. So todays date read 08/01/04, what i want it to read is 01/07/2004. I have tried =format(date, "dd/mm/yyyy" but to no avail, Excel seems to insist that i use mm-dd-yy !! Any ideas? --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Populating Cells in a row.
Worked a treat Tom !!
Many thanks (and to Dave also -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 07:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com