VBA code to keep data in parity between two worksheets

SamCha

New Member
Joined
Nov 23, 2020
Messages
28
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I am new to VBA and I am searching for an easy code to connect my data flow in 2 worksheets in the same macro workbook. One worksheet is the "Input" worksheet (Sheet 1) and the other is "Format" worksheet (Sheet 2). Manually data are entered in Sheet 1. Column B (Data starts from Row 15) in Sheet 1 is the main column where account numbers are entered. Rest of the cells are either connected to this account with vlookup or is REF cell. Column D in Sheet 2 is the REF column of Column B in Sheet 1. So both the column has the account numbers. Now what is required is if there is no account number in Sheet 1 in column B, that means no account number in Sheet 2 in column D - the entire row in Sheet 2 will be removed and if there is an account number the entire row will automatically be filled taking reference of the previous row. In Sheet 1 the account number entries vary (starting from Row 15) - sometimes being 20 entries and sometimes 5. Entry starts in Sheet 2 from Row 5. Range of data in Sheet 2 is from A1:DJ. If we have an account number in Column D - the entire range from A:DJ will be populated take ref from the row above and will be blank if Column D is blank
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

SamCha

New Member
Joined
Nov 23, 2020
Messages
28
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

Just to add to what I am looking for please refer to the Sheet 1 attached. I am not able to attach the Sheet 2. But what I meant was Sheet 1 and Sheet 2 have cell reference. Column B (starting from Row 15) in Sheet 1 is cell reference for Column D in Sheet 2 (Starting from Row 5). The size of the Debit account varies in Sheet 1. I am trying to find a solution that when there is no account number in a row in Sheet 1, the entire row in Sheet 2 will be deleted, and when there is an account number the entire row will take the formula reference in increasing order from row above. Hope I am able to explain.

Thanks in advance.
 

Attachments

  • Sheet 1.PNG
    Sheet 1.PNG
    37.6 KB · Views: 0

Watch MrExcel Video

Forum statistics

Threads
1,123,251
Messages
5,600,541
Members
414,386
Latest member
PARAMATHMA SENTHILNATHAN

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
Top