Copy and paste data into Input Box

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,568
Office Version
  1. 2021
Platform
  1. Windows
I have a user form that activates an input box

The code to activate the inputbox is



Code:
 Sub Input_Value()

Dim StartDate As String, EndDate As String, Arr As Variant
  With Sheets("Imported Data")
   .Range("Z1").Value = InputBox("Enter the value")
  End With

End Sub

When the input box is activcated, I would like to select the cell containing the value to be copied and pasted into the input box


It would be appreciated if someone could kindly advise how to do this and provide me with the code
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Is this what you want ?
VBA Code:
Sub Input_Value()
    Dim StartDate As String, EndDate As String, Arr As Variant
    With Sheets("Imported Data")
    .Range("Z1").Value = InputBox("Enter the value", , ActiveCell.Value)
    End With
End Sub
 
Upvote 0
Thanks for your reply. When the input box is activated, It does not allow me to select a cell to copy on the workbook and paste into the input box-see link below



Kindly amend your code to allow me to select a cell and copy and paste this into the inputbox , once the inputbox is acticated
 
Upvote 0

Forum statistics

Threads
1,215,641
Messages
6,125,983
Members
449,276
Latest member
surendra75

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