Simple Inputbox

Chewyhairball

Active Member
Joined
Nov 30, 2017
Messages
312
Office Version
  1. 365
Platform
  1. Windows
Hi

How do you get the following code to enter the data into the current selected cell instead of having to define a specific cell.? I am just looking

Dim i As Variant
i = InputBox("Please Enter Your Name", "Personal Information", "Type Here")
Range("A1").Value = i
End Sub
 

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.
Hi

try

Rich (BB code):
Dim i As Variant
    i = InputBox("Please Enter Your Name", "Personal Information", "Type Here")
    ActiveCell.Value = i

Dave
 
Upvote 0
Dim i As Variant i = InputBox("Please Enter Your Name", "Personal Information", "Type Here") ActiveCell.Value = i

What!!! that was the first thing I tried ( or I thought it was) and it didn't work. I thought it was that simple. I must have typed something wrong or I am losing the plot today.
Thanks very much DMT. :)
 
Upvote 0
you are welcome

If you want to add a little more functionality to your code

VBA Code:
Dim i As Variant
    Do
    i = InputBox("Please Enter Your Name", "Personal Information", "Type Here")
    'cancel pressed
    If StrPtr(i) = 0 Then Exit Sub
    Loop Until Len(i) > 0 And i <> "Type Here"
    ActiveCell.Value = i

Dave
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

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