Input Box to identify Column then Clearing only Numerical Data

Phenatic

New Member
Joined
Jan 20, 2010
Messages
5
Good afternoon,

I've tried and can't figure this out.

I would like an input box.. "What column would you like to clear?" Then I respond with a column letter (ex. H, I, J, K, L... there will only be one)

Then the VBA formula will clear all the numerical data from rows 2 through 175. It needs to leave all the formatting and formulas.

Thanks in advance.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Google is your friend with this one.

Here is an example of an input box. Here is an example of how to clear ranges.

VBA Code:
Sub InputAndClear()

    Dim Col As String
    Dim St As Integer
    Dim En As Integer
   
    St = 2
    En = 75
   
    Col = ""
    Col = InputBox("What column would you like to clear?", "Clear " & St & "-" & En)
   
    If Col <> "" Then
        'something was intered, go for it
        ThisWorkbook.ActiveSheet.Range(Col & St & ":" & Col & En).Value = ""
       
    End If

End Sub

--- EDIT ---
When googling anything related to VBA in Excel, you must include "Excel VBA" at the front. VBA is its own programming language that pre-dates Excel, and Excel has its own variation of VBA that it uses.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

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