Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Creating an custom input box

I was wondering if someone could help me here.
Im attempting to create an input box that will ask the user for a
number and in turn use this number to identify a sheet , then take
another input from the user and place it in a specific cell in the
sheet specified in the first step.

1.i will create an excel file with 31 sheets
2.when user runs file he will get a popup box asking for sheet wanted
3.the user will input a number between 1-31
4.a new box will open asking for data (lets assume a number)
5.Excel will place this value in Sheet(x) and a preassigned cell


Im very new to VBA so i apologise for the newbie post

any help on this owuld be appreciated. Thank you

  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

This should get you started. Press ALT+F11, double-click
on the ThisWorkbook module (if you don't see it, go to
View Project Explorer), and paste in the code below.
Press ALT+Q and save the workbook. Close and re-open.

Option Explicit
Sub Workbook_Open()
Dim SheetNo As Long
Dim sPrompt1 As String
Dim sPrompt2 As String
Dim dValuetoCell As Double
Dim rTargetCell As Range

Set rTargetCell = Range("A1")
sPrompt1 = "Enter a number, 1-31:"
sPrompt2 = "Enter value to " & _
"insert into cell " & _
rTargetCell.Address(False, False) & ":"

SheetNo = Application. _
InputBox(prompt:=sPrompt1, Type:=1)

Worksheets(SheetNo).Select

dValuetoCell = Application. _
InputBox(prompt:=sPrompt2, Type:=1)

ActiveSheet.Cells(rTargetCell.Row, _
rTargetCell.Column).Value = dValuetoCell

End Sub

---
Not much error-checking. If the user types in "32" on the
first Inputbox, the code will error.

HTH
Jason
Atlanta, GA

-----Original Message-----
I was wondering if someone could help me here.
Im attempting to create an input box that will ask the

user for a
number and in turn use this number to identify a sheet ,

then take
another input from the user and place it in a specific

cell in the
sheet specified in the first step.

1.i will create an excel file with 31 sheets
2.when user runs file he will get a popup box asking for

sheet wanted
3.the user will input a number between 1-31
4.a new box will open asking for data (lets assume a

number)
5.Excel will place this value in Sheet(x) and a

preassigned cell


Im very new to VBA so i apologise for the newbie post

any help on this owuld be appreciated. Thank you

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating custom list with a comma in it barnabel Excel Discussion (Misc queries) 6 January 10th 06 06:14 AM
Keep custom format in new worksheet Buddy Excel Discussion (Misc queries) 2 March 14th 05 10:03 AM
How to automate custom footer on all tabs neal august Excel Discussion (Misc queries) 1 March 3rd 05 02:38 PM
Creating custom colours in Excel 2002 Fletch Excel Discussion (Misc queries) 2 March 1st 05 05:55 PM
can you input time (hh:mm:ss) without having to input the colon i. Lexicon Excel Discussion (Misc queries) 4 January 11th 05 02:09 PM


All times are GMT +1. The time now is 08:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"