Populating Cells in a row.

J

Jako

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
 
T

Tom Ogilvy

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
 
J

Jako

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
 
T

Tom Ogilvy

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
 
D

Dave Peterson

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)
 
Top