How to update data that is on two worksheets but different formats

nmiller770678

New Member
Joined
Aug 9, 2022
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I have spreadsheet with a tab named Data and another named Monthly.
I have a User form that inputs the data into both these tabs with no issues.
The user form also allows for the updating of data as well as deleting of part#'s or entire records on the Data tab.
The issue I'm having is I haven't been able to get any code to work that will update changes to both the Data tab records and the Monthly records.
I am also looking for code that would delete records on both tabs but then move the remaining data so that there aren't any blank rows.

Example.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMAN
1
2Invoice #DateInvoice #Cust IDShip To StatePrepared ByExporting To?Part # 1Prod Name 1Registration 1Volume 1Lot# 1Repack 1Qty 1Total 1Part # 2Prod Name 2Registration 2Volume 2Lot# 2Repack 2Qty 2Total 2Part # 3Prod Name 3Registration 2Volume 3Lot # 3Repack 3Qty 4Total 3Part # 4Prod Name 4Registration3Volume 4Lot # 4Repack 4Qty 4Total 4Notes
36541239/28/2022654123KHKFLHJH1000-01Red Sneaker665544-0Formula123Original Order1Formula1000-04Red Sneaker w/Stripe665520-0Formula333Reorder1Formula2000-35ABlack Sneaker665543-0Formula444Reporder1FormulaFormulaFormulaNotes do not save on Monthly tab
48877659/28/2022887765KHALKH1000-01Red Sneaker665544-0Formula123Original Order1Formula
52234569/28/2022223456MYLBBNM3000-01Blue Sneaker665545-0Formula555No Reorder1Formula
64385422/1/2022438542USHKACanada4000-05Sandal55456-0Formula777Original Order1Formula4001-06Sandal w/Black SoleFormula321Reorder1Formula
72312213/4/2022231221QFYALML3002-02Black BootsFormula222Reorder2Formula
87812365/1/2023781236CCKDEML5622-01Trainer 456Original Order1Formula5622-04Trainer MultiFormula789No Reorder1Formula3451-01Boots AnkleFormula654No Reorder1Formula3002-02Black BootsFormula222Reorder2FormulaNotes do not save on Monthly tab
95216894/4/2023521689LSYCACanada4000-05Sandal55456-0Formula777Original Order2Formula
10
Data


Example.xlsx
ABCDEFGHIJKLMNOPQRST
1
2
3
4
5FormulaFormula
6Doesn't copy
7DateInvoice#Cust IDShip To StatePrepared ByExporting To?PartProd NameRegistrationVolumeQty 1Repack?Lot NumberTot Vol/QtyGroup By
89/28/2022654123KHKFLHJH1000-01Red Sneaker665544-01Original Order1232Sneaker
99/28/2022654123KHKNMHJH1000-04Red Sneaker w/Stripe665520-01Reorder3332Sneaker
109/28/2022654123KHKAZHJH2000-35ABlack Sneaker665543-01Reorder4443Sneaker
119/28/2022887765KHALKH1000-01Red Sneaker665544-01Original Order1231Sneaker
129/28/2022223456MYLBBNM3000-01Blue Sneaker665545-01No Reorder5552Sneaker
132/1/2022438542USHKACanada4000-05Sandal55456-01Original Order7771Sandal
142/1/2022438542USHKACanada4001-06Sandal w/Black Sole1Reorder3211Sandal
153/4/2022231221QFYALML3002-02Black Boots2Reorder2224Boots
165/1/2023781236CCKDEML5622-01Trainer 1Original Order4561Trainer
175/1/2023781236CCKDEML5622-04Trainer Multi1No Reorder7891Trainer
185/1/2023781236CCKDEML3451-01Boots Ankle1No Reorder6541Boots
195/1/2023781236CCKDEML3002-02Black Boots2Reorder2224Boots
204/4/2023521689LSYCACanada4000-05Sandal55456-02Original Order7774Sandal
21
22
23
Monthly
 
This is wonderful! I'll put it into the existing file later today or tomorrow and run some tests.
As for Invoice # in column A below is part of the code that references A for the monthly but I also use it for searching records. If I'm not mistaken I couldn't get the search to look at what is now invoice in col. C so I duplicate it in A.

Sheets("Monthly").Select


Set sh = ThisWorkbook.Sheets("Monthly")
lr = Sheets("Monthly").Range("A" & Rows.Count).End(xlUp).Row


'''''''''''Add data in Excel Sheet named Monthly - this is a different format than the Data tab'''''''''''


With sh
.Cells(lr + 1, "A").Value = Me.tbInvoice.Value
.Cells(lr + 1, "E").Value = Me.tbDate.Value
.Cells(lr + 1, "F").Value = Me.tbInvoice.Value
.Cells(lr + 1, "G").Value = Me.tbCust.Value
.Cells(lr + 1, "H").Value = Me.tbShipTo.Value
.Cells(lr + 1, "I").Value = Me.tbPrepared.Value
.Cells(lr + 1, "J").Value = Me.tbExport.Value

.Cells(lr + 1, "K").Value = Me.cbPN1.Value
.Cells(lr + 1, "L").Value = Me.tbPN1PN.Value
.Cells(lr + 1, "M").Value = Me.tbEPAReg1.Value
'.Cells(lr + 1, "N").Value = Me.tbVol1.Value
.Cells(lr + 1, "O").Value = Me.tbQty1.Value

.Cells(lr + 1, "P").Value = Me.cbRepack1.Value
.Cells(lr + 1, "Q").Value = Me.tbLot1.Value


End With
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I assure you I have limited VBA skills and my code is all over the place but it works and doesn't take forever to run! : )
 
Upvote 0
I'm clearly not doing something right....I've attempted to add your code to my existing document. It will save the record in both the Data and the Reports tab but it's very slow (assuming a combination of both codes together) and as far as updating records it won't do that at all.
I tried adding Call ConvertDataToReport and Call DeleteEmptyRows_Data to Private Sub cmdUpdate_Click() and Private Sub cmdSave_Click()
 
Upvote 0
I have a file that I've removed proprietary information from if you need me to send it to you.
 
Upvote 0
Sure, provide a link to the workbook. I'll add code to it. FYI I sort data by date. One effect is that empty rows are sorted to the bottom of the list which has the same effect as "deleting" the empty rows. So sub DeleteEmptyRows_Data is not needed/used. Also, the sub runs in about one second on my old pc.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top