Popup in excel macro

  • Thread starter Thread starter Hassan
  • Start date Start date
H

Hassan

Hi All,

I have macro which I'm applying on files but every time I have to make two
changes in macro, is it possible that the popup appear and ask for that two
values and store in b2 and c2?

Thanks in advance
 
The following is an example of getting user input. Lookup Inputbox in help
for more info on the the subject.

Sub InputData()

Dim data4B2 As Variant
Dim data4C2 As Variant

data4B2 = InputBox("Enter data for cell B2")
Sheets("Sheet1").Range("B2") = data4B2

data4C2 = InputBox("Enter data for cell C2")
Sheets("Sheet1").Range("C2") = data4C2

End Sub
 
Thanks for reply.
There is one more query that when I am apply following then I have to change
sheet name to Sheet1, is it possible to run on opened sheet, If yes then
where I have to make changes?

Thanks

Hassan
 
Change Sheets("Sheet1").Range("B2") = data4B2

To ActiveSheet.Range("B2") = data4B2

In both instances


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top