Dialog Box Query

  • Thread starter Thread starter John
  • Start date Start date
J

John

Where on the web can I obtain sample codes for a Dialog Box I wish to create
that will give 2 options, both of which, once clicked will bring me to tow
separate areas of my worksheet.

I'm a novice at coding so hence the request for some sample ones which I can
tailor for my needs


Rgds
 
http://www.microsoft.com/ExcelDev/Articles/sxs11pt1.htm
Lesson 11: Creating a Custom Form
Excerpted from Microsoft® Excel 97 Visual Basic® Step by Step.
http://j-walk.com/ss/excel/tips/tip84.htm


Peter Aiken Articles:
Part I
http://msdn.microsoft.com/library/en-us/dnoffpro01/html/IntroductiontoUserFormsPartI.asp
Part II
http://msdn.microsoft.com/library/en-us/dnoffsol02/html/IntroductiontoUserFormsPartII.asp



Private Sub OptionButton1_Click()
if optionbutton1.Value then
Application.GoTo Reference:=worksheets("sheet2").range("B9"), _
Scroll:=True
end if
End Sub

Private Sub OptionButton2_Click()
if optionbutton1.Value then
Application.GoTo Reference:=worksheets("sheet3").range("Z21"), _
Scroll:=True
end if
End Sub
 
Create a dialog box in VB Editor with Insert, UserForm. Add a couple of
buttons from the toolbox that sits beside it. Double-click on one of the
buttons: it takes you to the userform's class module and a special macro with
the name of the button underscore "Click". The kind of code you need is:
Range("A2:B5").Select (for the active sheet), preceded by
Worksheets("Sheet2").Activate to go to another sheet first, or
Range ("named range").Select

In an ordinary macro module, create a macro to run the userform with a line
like:
Userform1.Show

Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top