Deleting Manual Numbers

Ramneek

New Member
Joined
Mar 19, 2021
Messages
20
Office Version
  1. 2016
Platform
  1. Windows
Hi Experts,

I prepare monthly MIS reports wherein every month in several tabs of excel sheet, i need to delete manual numbers. I need a separate VBA code for each sheet wherein code will loop through each and every cell let's say, in tab "A" of column B to Z and row 1 to 1000 and if its find the manual numbers (not containing any formula or text) , it will delete the numbers.

I need a dummy code and then i will customize it according to the requirement of every sheet.

Thanks in advance.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Give this a try with a copy of your workbook as a starting point.

VBA Code:
Sub Delete_Nums()
  Dim ws As Worksheet
  
  On Error Resume Next
  For Each ws In Worksheets
    ws.Range("B1:Z1000").SpecialCells(xlConstants, xlNumbers).ClearContents
  Next ws
  On Error GoTo 0
End Sub
 
Upvote 0
Hi Sir,
Thanks for your help. Actually, I am too naïve in VBA programming and can do only small things using it.

I understand from the code, that it will loop through every worksheet in the excel file. But, could you please provide the code assuming that I have only tab (worksheet) in the excel file and the code will loop through the cells of the single worksheet only. and then i will customize the code for every sheet.

Thanks
 
Upvote 0
This would work on the first worksheet in the workbook only.
There should be no need for a loop which would only slow the code considerably.

VBA Code:
Sub Delete_Nums_v2()
  On Error Resume Next
  Sheets(1).Range("B1:Z1000").SpecialCells(xlConstants, xlNumbers).ClearContents
  On Error GoTo 0
End Sub
 
Upvote 0
Hi Sir,

Thanks a lot. It will save the time and energy massively in deleting the number. Thanks a ton for educating that there is no need of looping in this case.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)

Post back here if you end up needing help to apply it to multiple sheets.
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,156
Members
448,948
Latest member
spamiki

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