Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50123

Copy data in certain columns in one worksheet to a second worksheet

$
0
0
Hello,

I am new to macros and VBA programming. I am working on creating an Excel timesheet that will allow me to enter in the employee schedule and keep track of the hours worked. So far I have been successful in accomplishing the main timesheet, where data is entered. I am having difficulty with the next part. I want to copy data in 4 columns of the Timesheet worksheet and paste them in a second worksheet entitled Data Transferred to DB. The data in Data Transferred to DB will be imported by Access to then be used in a third worksheet called Tips.

Here is the logic that I want to have happen:
  • Check to see if there is data in column C starting at C5 for "NDB Timesheet" worksheet
  • If so then copy C5, C6, C7, C8...until there is no data entered (once it comes across an empty cell it stops the loop)
  • Paste this data into "Data Transferred to DB" column A starting at A2 (I have headers created in A1, B1, C1, and D1)--I only need to preserve the value and formatting when pasting
  • Check to see if there is data in A2 for "NDB Timesheet" worksheet
  • If so then copy A2 to B2 in "Data Transferred to DB" worksheet
  • B2 must then be copied down the B column for all A cells that contain data (if for example there are 12 records in A then there should only be 12 copies of B2, no more no less)
  • Check to see if there is data in B2 for "NDB Timesheet" worksheet
  • If so then copy B2 to C2 in "Data Transferred to DB" worksheet
  • C2 must then be copied down the C column for all A cells that contain data (if for example there are 12 records in A then there should only be 12 copies of C2, no more no less)
  • Check to see if there is data in column T starting at T5 for "NDB Timesheet" worksheet
  • If so then copy T5, T6, T7, T8...until there is no data entered (once it comes across an empty cell it stops the loop)
  • Paste this data into "Data Transferred to DB" column D starting at D2 (I have headers created in A1, B1, C1, and D1)--I only need to preserve the value and formatting when pasting

The final part is to have this data in "Data Transferred to DB" exported to Access or to have Access import the data. I am open for the best recommendations as to how to accomplish this last part.

Is it possible to have this done as the user enters data into the fields automatically or will the user have to input all the data and then when they are done hit a button that calls a macro to transfer the data to the second worksheet and exports/imports the data to the DB "NDB_Employees"?

Thanks in advance for any help resolving this.

Steve

Viewing all articles
Browse latest Browse all 50123

Trending Articles