Delete Cell Range, or Add Range and Copy Formulas etc. - Excel VBA

CSTjr

New Member
Joined
Jul 27, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hoping someone can help. I have a worksheet that i need to remove or add a cell range(s) (red border area) from the 1st row down the column to a specific point (Stop Line) which can change dynamically. The more ID's added or removed in the rows will push the Stop Line down or up. Also, the more data columns added or removed will push everything right or left. I can remove entire columns or rows but don't know VBA well enough to do what i need. Here are the details of what I am looking for;

1. I'd like to use a button to activate
2. I'd like to be asked "Add or Remove columns?" (MsgBox)
3. Add - I'd like to input the number of new data columns needed (Application.InputBox), should be >1, -click ok
3a. Add - New columns (row 1 to Stop Line), I'd like to be asked to select where to add the new data column(s) (Application.InputBox)
3b. I would like to select an individual row 1 cell that would add a new column(s) down to the Stop Line and shift other columns to the right. -click ok
3c. All formulas / cell data would be copied over to the new column(s)
4. Remove - Existing columns (row 1 to Stop Line), I'd like to be asked to select which data columns need to be removed (Application.InputBox).
4a. I would like to select an individual row 1 cell or multiple row 1 cells that would delete the column to the Stop Line and shift other columns left. -click ok

On row 49 I was messing around with adding an “x” to existing columns to indicate where to stop the column range when trying to delete but I could not get that to work. I have no issue if the “x” is required or will assist in the operation of the VBA, only that if a new column is added, the “x” is added at the bottom via the VBA.

The worksheet name is dynamic but the VBA would only be effecting the active worksheet and i cannot add a new row at the top of the worksheet and shift the existing row 1 down without effecting multiple other worksheets and data.

I have attached a general outline of the current worksheet for review.....and thank you ahead of time for any assistance!!!

-CST
 

Attachments

  • Screenshot 2024-04-11 at 10.41.57 AM.jpg
    Screenshot 2024-04-11 at 10.41.57 AM.jpg
    125.3 KB · Views: 16

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,883
Messages
6,175,167
Members
452,615
Latest member
bogeys2birdies

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