![]() |
Multiple inputs from "Input Box"
I want to get multiple entries to paste to another sheet. I have the
following input box working to request one entry. Can anyone tell me how to use the same box for multiple requests to append to "Sheet1"? Also, if entry is wrong, I need to just return them back to the input box. Please forgive any mistakes, I just had brain surgery...Really!! Market = Application.InputBox("Enter your market") Sheets("Daily_info").Select Range("A1").Select Selection.AutoFilter Selection.AutoFilter Field:=18, Criteria1:=Market, Operator:=xlAnd Range("A1").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select Selection.Copy Sheets("Sheet1").Select ActiveSheet.Paste |
Multiple inputs from "Input Box"
Here's how I do it:
Dim ReportTime As String Dim strDate As String Dim strTime As String ReportTime = InputBox("Enter date and time (24-hour time format):" & vbCr & vbCr & "Ex: 8/1/2008 18:30 (for 6:30 pm).") strDate = Left$(ReportTime, WorksheetFunction.Find(" ", ReportTime) - 1) strTime = Right$(ReportTime, Len(ReportTime) - WorksheetFunction.Find(" ", ReportTime)) After you run this, the two separate elements from the Inputbox are stored in two string variables. HTH, JP On Aug 11, 2:26*pm, Megadrone wrote: I want to get multiple entries to paste to another sheet. I have the following input box working to request one entry. Can anyone tell me how to use the same box for multiple requests to append to "Sheet1"? Also, if entry is wrong, I need to just return them back to the input box. Please forgive any mistakes, I just had brain surgery...Really!! Market = Application.InputBox("Enter your market") * * Sheets("Daily_info").Select * * Range("A1").Select * * Selection.AutoFilter * * Selection.AutoFilter Field:=18, Criteria1:=Market, Operator:=xlAnd * * Range("A1").Select * * Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select * * Selection.Copy * * Sheets("Sheet1").Select * * ActiveSheet.Paste |
Multiple inputs from "Input Box"
I do believe I was misunderstood, I want them to enter an item in the input
box (it is them pasted to Sheet1) then I want them to be able to return to the input box and enter another item and so on. when they are finished I want some way to end the input function. "JP" wrote: Here's how I do it: Dim ReportTime As String Dim strDate As String Dim strTime As String ReportTime = InputBox("Enter date and time (24-hour time format):" & vbCr & vbCr & "Ex: 8/1/2008 18:30 (for 6:30 pm).") strDate = Left$(ReportTime, WorksheetFunction.Find(" ", ReportTime) - 1) strTime = Right$(ReportTime, Len(ReportTime) - WorksheetFunction.Find(" ", ReportTime)) After you run this, the two separate elements from the Inputbox are stored in two string variables. HTH, JP On Aug 11, 2:26 pm, Megadrone wrote: I want to get multiple entries to paste to another sheet. I have the following input box working to request one entry. Can anyone tell me how to use the same box for multiple requests to append to "Sheet1"? Also, if entry is wrong, I need to just return them back to the input box. Please forgive any mistakes, I just had brain surgery...Really!! Market = Application.InputBox("Enter your market") Sheets("Daily_info").Select Range("A1").Select Selection.AutoFilter Selection.AutoFilter Field:=18, Criteria1:=Market, Operator:=xlAnd Range("A1").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select Selection.Copy Sheets("Sheet1").Select ActiveSheet.Paste |
Multiple inputs from "Input Box"
Inputbox returns "" when Cancel is pressed. Wrap the Inputbox in a Do
Loop that checks if the returned string is "", then you know the user is finished. Otherwise it keeps looping and asking for more input. You can also do simply data validation on the inputted string, for example IsDate() to make sure the user entered a valid date. Anything more complicated than that, an Inputbox is inadequate; you'd want to use a userform. Dim ReportTime As String Dim strDate As String Dim strTime As String Do Until ReportTime = "" ReportTime = InputBox("Enter date and time (24-hour time format):" & vbCr & vbCr & "Ex: 8/1/2008 18:30 (for 6:30 pm).") strDate = Left$(ReportTime, WorksheetFunction.Find(" ", ReportTime) - 1) strTime = Right$(ReportTime, Len(ReportTime) - WorksheetFunction.Find(" ", ReportTime)) Loop On Aug 11, 3:06*pm, Megadrone wrote: I do believe I was misunderstood, I want them to enter an item in the input box (it is them pasted to Sheet1) then I want them to be able to return to the input box and enter another item and so on. *when they are finished I want some way to end the input function. "JP" wrote: Here's how I do it: Dim ReportTime As String Dim strDate As String Dim strTime As String ReportTime = InputBox("Enter date and time (24-hour time format):" & vbCr & vbCr & "Ex: *8/1/2008 18:30 (for 6:30 pm).") strDate = Left$(ReportTime, WorksheetFunction.Find(" ", ReportTime) - 1) strTime = Right$(ReportTime, Len(ReportTime) - WorksheetFunction.Find(" ", ReportTime)) After you run this, the two separate elements from the Inputbox are stored in two string variables. HTH, JP On Aug 11, 2:26 pm, Megadrone wrote: I want to get multiple entries to paste to another sheet. I have the following input box working to request one entry. Can anyone tell me how to use the same box for multiple requests to append to "Sheet1"? Also, if entry is wrong, I need to just return them back to the input box. Please forgive any mistakes, I just had brain surgery...Really!! Market = Application.InputBox("Enter your market") * * Sheets("Daily_info").Select * * Range("A1").Select * * Selection.AutoFilter * * Selection.AutoFilter Field:=18, Criteria1:=Market, Operator:=xlAnd * * Range("A1").Select * * Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select * * Selection.Copy * * Sheets("Sheet1").Select * * ActiveSheet.Paste- Hide quoted text - - Show quoted text - |
All times are GMT +1. The time now is 08:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com