Clear data in a cell using a macro

jarrodexcel

New Member
Joined
Dec 14, 2022
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Trying to use a macro on excel to clear a column of data containing data, for example B2 down to B1500.
I need it so when i click the macro it will clear this selection.
Problem is i have another macro doing this on sheet two.
But i cant work out how to set up two macros doing the same thing on different sheets, when i try it overrides the other macro and inputs the same data.

Columna to delete data on sheet one is I2 - I 1500
Column on sheet 2 is B2-b1500


Any help would be appreciated. Thanks a bunch.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
It should be simple to specify which sheet each macro is applicable to. Can you share your macros so that we can assist you?
 
Upvote 0
Try:

VBA Code:
Sub ClearArea()
  Sheets("Sheet1").Range("I2:I1500").ClearContents
  Sheets("Sheet2").Range("B2:B1500").ClearContents
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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