Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Newbie - populate (macro) GUI from Excel cells

Hello,

I am NEW to automating Excel. I have gone into the macro editor and am
"designing" a GUI for a large Excel spreadsheet. Right now I have one drop down
list box and several fields (text boxes). I have figured out how to
automatically populate the list box with values from one of the columns in the
spreadsheet. What I'd like to do now is: Once I select a value in the list box
(server name) I would like for the fields (test boxes on the GUI) to
automatically populate with the appropriate cell values from the row where the
server name appears. I don't know how to do this. Help!!!

Any suggestions will be greatly appreciated.

TIA,
Bill Burke


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Newbie - populate (macro) GUI from Excel cells

Assuming your GUI is a userform with a ComboBox called ComboBox1 and a
Textbox called TextBox1, take a look at the Change event.

Something like this should do the trick:

Private Sub ComboBox1_Change()
TextBox1.Text = ComboBox1.Value
End Sub

Bill Burke wrote:
Hello,

I am NEW to automating Excel. I have gone into the macro editor and am
"designing" a GUI for a large Excel spreadsheet. Right now I have one drop down
list box and several fields (text boxes). I have figured out how to
automatically populate the list box with values from one of the columns in the
spreadsheet. What I'd like to do now is: Once I select a value in the list box
(server name) I would like for the fields (test boxes on the GUI) to
automatically populate with the appropriate cell values from the row where the
server name appears. I don't know how to do this. Help!!!

Any suggestions will be greatly appreciated.

TIA,
Bill Burke



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Newbie - populate (macro) GUI from Excel cells

Sorry, I misread the OP as being simpler than it was.

Let's assume you populated the ComboBox with the values from column A,
in the same order as they appear on the sheet.
This leaves row 1 from the sheet in ListIndex 0 of the combobox.

The following Change event would put column B of the selected item into
TextBox1

''''''''''''
Private Sub ComboBox1_Change()
With ThisWorkbook.Sheets("Sheet1")
TextBox1.Text = .Cells(ComboBox1.ListIndex + 1, 2)
End With
End Sub
''''''''''''
Tested using the following UserForm_Initialize event:
Private Sub UserForm_Initialize()
Dim i&
With ThisWorkbook.Sheets("Sheet1")
For i& = 1 To 10
ComboBox1.AddItem .Cells(i&, 1).Value
Next i&
End With
End Sub


Steve Garman wrote:
Assuming your GUI is a userform with a ComboBox called ComboBox1 and a
Textbox called TextBox1, take a look at the Change event.

Something like this should do the trick:

Private Sub ComboBox1_Change()
TextBox1.Text = ComboBox1.Value
End Sub

Bill Burke wrote:

Hello,

I am NEW to automating Excel. I have gone into the macro editor and am
"designing" a GUI for a large Excel spreadsheet. Right now I have one
drop down
list box and several fields (text boxes). I have figured out how to
automatically populate the list box with values from one of the
columns in the
spreadsheet. What I'd like to do now is: Once I select a value in
the list box
(server name) I would like for the fields (test boxes on the GUI) to
automatically populate with the appropriate cell values from the row
where the
server name appears. I don't know how to do this. Help!!!

Any suggestions will be greatly appreciated.

TIA,
Bill Burke




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
Excel macro to populate Outlook email? Fyste Excel Discussion (Misc queries) 1 January 14th 08 03:47 PM
How can I have Excel cells populate a Word label template? MS Questionnairess Excel Discussion (Misc queries) 1 June 8th 06 01:26 AM
Please help a newbie with an excel vba macro relating to comments. zulfer7 Excel Discussion (Misc queries) 8 May 19th 06 10:40 PM
how do i set up drop down menus to populate cells in excel? Louise Scott Excel Discussion (Misc queries) 2 May 29th 05 07:19 PM
Excel VBA -Force users to populate custom form cells tschultz Excel Programming 1 April 2nd 04 07:17 PM


All times are GMT +1. The time now is 10:57 AM.

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"