![]() |
Inputting data through a VBA input box
I'm learning VBA, but it's slow going and I'm struggling with some areas
which I'm sure should be simple..... I want to run a macro that brings up a simple input box. The user enters an 8 digit number and then clicks on OK. I want this number to be placed in a specific cell in my workbook. How can I achieve this please? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Inputting data through a VBA input box
Chris, use something like this
Sub Number() MyNum = InputBox("Enter Discount Amount", "Discount Amount") If MyNum = "" Then Exit Sub End If Range("B6").Value = MyNum End Sub -- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Big Chris" wrote in message ... I'm learning VBA, but it's slow going and I'm struggling with some areas which I'm sure should be simple..... I want to run a macro that brings up a simple input box. The user enters an 8 digit number and then clicks on OK. I want this number to be placed in a specific cell in my workbook. How can I achieve this please? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Inputting data through a VBA input box
Something like this:
Dim X As Variant X = InputBox("enter something") If X < "" Then Cells(1, 1) = X tom @ the domain below www.tomchester.net "Big Chris" wrote in message ... I'm learning VBA, but it's slow going and I'm struggling with some areas which I'm sure should be simple..... I want to run a macro that brings up a simple input box. The user enters an 8 digit number and then clicks on OK. I want this number to be placed in a specific cell in my workbook. How can I achieve this please? |
Inputting data through a VBA input box
Forgot to take the titles out of the example
Sub Number() MyNum = InputBox("Enter Your Number", "Title here") If MyNum = "" Then Exit Sub End If Range("B6").Value = MyNum End Sub "Paul B" wrote in message ... Chris, use something like this Sub Number() MyNum = InputBox("Enter Discount Amount", "Discount Amount") If MyNum = "" Then Exit Sub End If Range("B6").Value = MyNum End Sub -- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Big Chris" wrote in message ... I'm learning VBA, but it's slow going and I'm struggling with some areas which I'm sure should be simple..... I want to run a macro that brings up a simple input box. The user enters an 8 digit number and then clicks on OK. I want this number to be placed in a specific cell in my workbook. How can I achieve this please? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Inputting data through a VBA input box
Thanks for your help. Much appreciated....I'll be back!
------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 05:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com