Macro to Transfer info from one sheet to another

G

Guest

I have a workbook that has multiple sheets in it. I want the first sheet to
have a "form" in a sense that will allow a user to input information in
different boxes and then "Submit" the information by clicking on a button.
When the button is hit, I want a macro to run that copies that information in
the boxes and pastes it into the first blank row from the top in two sheets
(so that it can be added to each day): the sheet for each employee and also
the sheet for each client. The form looks something like this:

Date Client Description Initals
( ) ( ) ( ) ( )

Total Hours Non-Billable Intercompany Billable
( ) ( ) ( ) ( )

Where the parenthesis are cells that they can enter information. On the
different tabs, I have each of these fields at the top of the page and
columns under each one. I need the information in each cell that is entered
to transfer to the appropriate sheet based on initials and client (for
instance, if the initials are DF and the client is "Top of the Line", then I
need the entire set of data transferred to the first blank row in the DF tab
and the "Top of the Line" tab. There are other cells that will have to
transfer as well, but I'm not sure how to make it happen. Thanks for the
help!

Aaron
 
G

Guest

assume the labels are in rows 1 and 3 and each column is used successively.

Sub buttonClick()
Dim sh as Worksheet, sh1 as worksheet
Dim rw as Long
set sh = Worksheets(cells(2,"B").Value)
set sh1 = Worksheets(cells(2,"D").Value)
with sh
set rw = .Cells(rows.count,1).End(xlup).row + 1
.cells(rw,1).Resize(1,4).Value = Range("A2:D2").Value
.cells(rw,5).Resize(1,5).Value = Range("A4:E4").Value
End with

with sh1
set rw = .Cells(rows.count,1).End(xlup).row + 1
.cells(rw,1).Resize(1,4).Value = Range("A2:D2").Value
.cells(rw,5).Resize(1,4).Value = Range("A4:D4").Value
End with
End Sub

Code is untested and may contain typos. Adjust to fit your needs.
 

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