stormseeker75
New Member
- Joined
- Mar 19, 2025
- Messages
- 21
- Office Version
- 365
- Platform
- Windows
Here's my setup:
Workbook = WORK_ORDERS
Worksheet = DATABASE
Worksheet = SALES_SHEET_MASTER
DATABASE has the following columns
ITEM_NO
ACCEPT
DECLINE
HOURS
COMPLAINT_1
COMPLAINT_2
CAUSE
CORRECTION
SALES_SHEET_MASTER has a much less organized layout because the spreadsheet is being used as a repair order form. What matters is that I have a a repeating series of blocks of data. For each block, I have an ascending number (1, 2, 3....) in column R.
What I would like the code to do is to look through column R on SALES_SHEET_MASTER and anytime it finds a number, I want it to copy certain cells to the DATABASE tab into each column.
I have done a bit of reading and I don't know if we should use a For...Next or a Range.Find. I think that when the code finds a number, we could use Offset to create a relative position to copy? I have no idea how to do the loop through the paste portion but I wanted to at least give a try on the loop to find the data and select it.
The first cell I am trying to select and copy is in Column A. I don't know how to paste once I've selected it. There are also other cells that need to be copied to the DATABASE tab. If my offset methodology is correct, I can probably figure that part out.
Workbook = WORK_ORDERS
Worksheet = DATABASE
Worksheet = SALES_SHEET_MASTER
DATABASE has the following columns
ITEM_NO
ACCEPT
DECLINE
HOURS
COMPLAINT_1
COMPLAINT_2
CAUSE
CORRECTION
SALES_SHEET_MASTER has a much less organized layout because the spreadsheet is being used as a repair order form. What matters is that I have a a repeating series of blocks of data. For each block, I have an ascending number (1, 2, 3....) in column R.
What I would like the code to do is to look through column R on SALES_SHEET_MASTER and anytime it finds a number, I want it to copy certain cells to the DATABASE tab into each column.
I have done a bit of reading and I don't know if we should use a For...Next or a Range.Find. I think that when the code finds a number, we could use Offset to create a relative position to copy? I have no idea how to do the loop through the paste portion but I wanted to at least give a try on the loop to find the data and select it.
The first cell I am trying to select and copy is in Column A. I don't know how to paste once I've selected it. There are also other cells that need to be copied to the DATABASE tab. If my offset methodology is correct, I can probably figure that part out.
VBA Code:
For Each cell In SALES_SHEET_MASTER.Range("R1:R & Cells(Rows.Count, 2).End(xlUp).Row)
If Not IsEmpty(cell) Then
activecell.offset.(columnOffset:=-17).select
selection.copy
End If
Next