ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to show messge box text in Excell work sheet (https://www.excelbanter.com/excel-programming/342805-how-show-messge-box-text-excell-work-sheet.html)

vishu

How to show messge box text in Excell work sheet
 
I have created as user forms, When user enter a text in user forms, that
should appear in Excel work sheet say for Eg: Cell A1
Can you please add codes to this:

Sub GetDataFromUser()
Dim strUserInput As String
strUserInput = InputBox("Please enter your name.", "Name")
MsgBox "Your name is " & strUserInput
Call GetAddress(strUserInput)
End Sub
Sub GetAddress(ByVal UserName As String)
Dim strAddress As String
strAddress = InputBox("Hi, " & UserName & ". What is your address",
"Address")
MsgBox UserName & " lives at " & strAddress
End Sub



Regards,
Vishu


JakeyC

How to show messge box text in Excell work sheet
 
You didn't specify exactly how you wanted the data to appear, and the
cell's format will be important but I'm sure you can modify the
following:

Sub GetDataFromUser()
Dim strUserInput As String
strUserInput = InputBox("Please enter your name.", "Name")
MsgBox "Your name is " & strUserInput
Call GetAddress(strUserInput)
End Sub
Sub GetAddress(ByVal UserName As String)
Dim strAddress As String
strAddress = InputBox("Hi, " & UserName & ". What is your address",

"Address")
MsgBox UserName & " lives at " & strAddress
End Sub


Sub PutItInTheCell(ByVal straddress, username As String)

Range("A1").Value = "Name: " & username & Chr(10) & "Address: " &
straddress

End Sub


JakeyC

How to show messge box text in Excell work sheet
 
Sorry - you should add the line:

Call PutItInTheCell(straddress, username)

before the 'End Sub' of GetAddress()



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

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