ENTER DATA - LOG ENTRIES ON SEPERATE SHEET (IN SAME BOOK)

B

Bull

Hello guys,
A little Help here...I can't figure it out.

I have one sheet in my workbook called DATA. On the DATA sheet, I
enter the Last Name in Cell C3, I enter the First Name in Cell C5, I
enter the middle name in C7 and the Worker ID in W3. After these
cells, I have a command button (Button 6), it is labeled: "ADD TO
LOG".

I have another sheet in the same workbook called LOG. On this sheet I
would like to log each name I enter in the DATA sheet. The first
person I enter starts on Row 3. The next person I enter would go in
Row 4, and this would keep going.. For example...in the LOG sheet,
the first column would have LAST, FIRST MIDDLE in column A; the second
column on the LOG sheet would have the worker's ID.

I want to be able to push the command button (button 6) and the DATA
sheet, and automatically have the data put on the next row down in the
LOG sheet.

Can someone throw some CODE my way ???? I appreciate it guys.
 
G

Guest

You say you have a commandbutton, but they are usually named like
CommandButton6. this represents the event (located in the sheet module) for
such a commandbutton. If it is a button from the forms toolbar instead (which
matches the name you cite), put the code in a general module and assign it to
the button.

Private Sub commandButton6_click()
Dim sh as Worksheet, lastrow as Long
set sh = Worksheets("Data")
With worksheets("Log")
lastrow = Cells(rows.count,1).End(xlup).row +1
if lastrow < 3 then lastrow = 3
.Cells(lastrow,1).Value = sh.Range("C3").Value & ", " & _
sh.Range("C5").Value & " " & sh.Range("C7").Value
.Cells(lastrow,2).Value = sh.Range("W3").Value
End with
end Sub
 
B

Bull

Tom, wow...where in the heck do you learn all this stuff...I think
your name is all over these forums...thanks alot.
 
B

Bull

You say you have a commandbutton, but they are usually named like
CommandButton6. this represents the event (located in the sheet module) for
such a commandbutton. If it is a button from the forms toolbar instead (which
matches the name you cite), put the code in a general module and assign it to
the button.

Private Sub commandButton6_click()
Dim sh as Worksheet, lastrow as Long
set sh = Worksheets("Data")
With worksheets("Log")
lastrow = Cells(rows.count,1).End(xlup).row +1
if lastrow < 3 then lastrow = 3
.Cells(lastrow,1).Value = sh.Range("C3").Value & ", " & _
sh.Range("C5").Value & " " & sh.Range("C7").Value
.Cells(lastrow,2).Value = sh.Range("W3").Value
End with
end Sub

--
Regards,
Tom Ogilvy









- Show quoted text -

Tom. Thanks again..but how to I make the entry move to the next row
down, so it keeps a running log. Go to next row if previous row in
the sheet "LOG" is full?

Thanks
 
B

Bull

Tom. Thanks again..but how to I make the entry move to the next row
down, so it keeps a running log. Go to next row if previous row in
the sheet "LOG" is full?

Thanks- Hide quoted text -

- Show quoted text -

Anyone??? How to make the entry move to the next row down, so it
keeps a running log. Go to next row if previous row in the same sheet
is full?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top