ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help needed with Inputbox problem (https://www.excelbanter.com/excel-programming/387143-re-help-needed-inputbox-problem.html)

Gary''s Student

Help needed with Inputbox problem
 
You can cheat and get both items with a single inputbox call:


Sub single_input()
Dim x As String
x = Application.InputBox("enter account, value", Type:=2)
s = Split(x, ",")
Range("H12").Value = s(0)
Range("K12").Value = s(1)
MsgBox (x)
End Sub

basically we input a string and then separate it into substrings using the
comma as the separator. Then we process the substrings individually.

--
Gary''s Student - gsnu200714


"Les Stout" wrote:

Hi all, i have the following code that is working fine, i just need to
add another range and input within the loop.
After the "Account Number" i to put in the value for the account in the
Range("K12:K18"), can i include it in this loop or must i do a different
one ??


For Each x In Range("H12:H18")
x.Value = InputBox("Please enter the Account number..." & vbCrLf &
vbCrLf & _
"To end input, enter nothing", "ACCOUNT NUMBER")
If x.Value = "" Then Exit Sub
Next


Les Stout

*** Sent via Developersdex http://www.developersdex


Les Stout[_2_]

Help needed with Inputbox problem
 
Thanks Gary, how would i loop that from line 12 to 18 ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Gary''s Student

Help needed with Inputbox problem
 
Sub single_input()
Dim x As String
For i = 12 To 18
x = Application.InputBox("enter account, value", Type:=2)
If x = "" Then
Exit Sub
End If
s = Split(x, ",")
Cells(i, "H").Value = s(0)
Cells(i, "K").Value = s(1)
Next
End Sub

Remember Les, this is only demo code to show how to use Split. You should
make your inputbox prompt as descriptive as possible. Leave your users no
degrees of freedom.
--
Gary''s Student - gsnu200714


"Les Stout" wrote:

Thanks Gary, how would i loop that from line 12 to 18 ??

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


Les Stout[_2_]

Help needed with Inputbox problem
 
Thanks a mil Gary"s Student, much appreciated... great evening/Day to
all

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com