InputBox value to be current selection

Fyr

Active Member
Joined
Jan 20, 2009
Messages
375
I'm using this script:
Code:
Sub deletename()
     
    inpData = Application.InputBox("Select name to delete in this worksheet and others at right")
    For s = ActiveSheet.Index To Sheets.Count
        Set c = Sheets(s).Range("A1:A65536").Find(inpData)
        If Not c Is Nothing Then
            c.EntireRow.Delete
        End If
    Next s
End Sub

I want the inputbox data to be my current selection.
For example, lets say my selection is cell A20, I want the inputbox value to be the value of A20.

Thanks for taking a look!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi Fyr,

Try

x = ActiveCell.Text
inpData = Application.InputBox("Select name to delete in this worksheet and others at right", , x)

ColinKJ
 
Upvote 0
Hi Try :-
Code:
Dim inpdata As Range
Set inpdata = Application.InputBox(prompt:="Your Prompt ", Title:="Your Title", Type:=8)
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,207,094
Messages
6,076,549
Members
446,212
Latest member
KJAYPAL200

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