Forum Discussion
Copy form Cell(s) on Sheet A to Sheet B if Cell A changes, then clear cells on Sheet A
Ok, this may have been asked before but here is what I am working with.
I am new to coding in Excel with MB and/or Macros so any assistance is appreciated. I have looked over some other code already posted as answers to similar questions but am unsure how I would modify it for my needs.
Excel workbook with 2 Sheets.
Sheet 1 has data in 13 rows with Columns A through F containing data for each Row
Data Starts at Cell A4 With Cell C4 being a drop-down with 2 options
Calls A4 and B4 are static info
Cell F4 automatically changes based on the option in the drop-down
Cells D4 and E4 are manual entry data
What I am looking to do for the 13 rows of data is the following
When Cell C4 is changed from Option 1 to Option 2 copy Cells A4, D4, E4, and F4 to Sheet 2 starting in Row 2 then clear the contents of Dells D4 and E4 on Sheet 1
The next time this is triggered it should populate the next row in sheet 2
This will need to work for all 13 rows in sheet 1
Sample data on Sheet 1
Pass | Status | Visitor Info (Name / Company) | Reason for Visit / Person Visiting | Signed out on | |
Visitor Pass 1 | 8:30 AM - 5 PM Mon - Fri | Signed out | ??? | ??? | May 3, 2023 |
Sample data for Sheet 2 after the copy
Cells A4 to A2, D4 to B2, E4 to C2, F4 to D2 Cell E2 is auto-populated when the copy is done.
Pass | Visitor Info (Name / Company) | Reason for Visit / Person Visiting | Signed Out On | Signed In On |
Visitor Pass 1 | ??? | ??? | May 3, 2023 | May 3, 2023 |
- The easiest way by far to get into VBA for Excel is to "Record Macro". The relevant button is on the "Developer" ribbon, which is hidden by default. Add it to your ribbon via File/Options. Start recording and simply execute the actions you want performed. Stop recording and behold what macro the recorder has produced. Optimize manually after.
Know also that ChatGBT is a confident coder in VBA.
1 Reply
- ecovonreinIron ContributorThe easiest way by far to get into VBA for Excel is to "Record Macro". The relevant button is on the "Developer" ribbon, which is hidden by default. Add it to your ribbon via File/Options. Start recording and simply execute the actions you want performed. Stop recording and behold what macro the recorder has produced. Optimize manually after.
Know also that ChatGBT is a confident coder in VBA.