Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default fetch a value from a w/sheet to userform.

I have a userform with a combobox 1,a text box 1and a command button(fetch)
I want sheet1! A2 to last used cell in Col A as combobox 1 values.
If a a value is selected from combox list ,and click fetch command button,
then vlookup that value from sheet1A2:F200,from column 5 fetch to textbox1.
what code I have to add to userform code module for above 2 tasks.
Thanks in advance to all Vba experts.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200905/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default fetch a value from a w/sheet to userform.

with just your combobox you could accomplish what you're describing. Set the
combobox columncount property to 2, then use the following code for the form.
Vlookup isn't needed at all this way. The combobox shows what's in the
second column, and can return that value anywhere you want to use it. But if
you absolutely had to have it in a textbox for some reason, this shows that
as well. You really don't need the "fetch" button.

Private Sub UserForm_Initialize()

Dim myList As String
Dim LastRow As Integer

LastRow = Range("a2").End(xlDown).Row
myList = Range(Cells(2, 1), Cells(LastRow, 2)).address
ComboBox1.RowSource = myList

End Sub

Private Sub ComboBox1_Change()

TextBox1 = ComboBox1.Column(1)

End Sub



"tkraju via OfficeKB.com" wrote:

I have a userform with a combobox 1,a text box 1and a command button(fetch)
I want sheet1! A2 to last used cell in Col A as combobox 1 values.
If a a value is selected from combox list ,and click fetch command button,
then vlookup that value from sheet1A2:F200,from column 5 fetch to textbox1.
what code I have to add to userform code module for above 2 tasks.
Thanks in advance to all Vba experts.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200905/1


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default fetch a value from a w/sheet to userform.

Thank you ,Slarbie,I got what I need, can you explain me the code,line by
line.

slarbie wrote:
with just your combobox you could accomplish what you're describing. Set the
combobox columncount property to 2, then use the following code for the form.
Vlookup isn't needed at all this way. The combobox shows what's in the
second column, and can return that value anywhere you want to use it. But if
you absolutely had to have it in a textbox for some reason, this shows that
as well. You really don't need the "fetch" button.

Private Sub UserForm_Initialize()

Dim myList As String
Dim LastRow As Integer

LastRow = Range("a2").End(xlDown).Row
myList = Range(Cells(2, 1), Cells(LastRow, 2)).address
ComboBox1.RowSource = myList

End Sub

Private Sub ComboBox1_Change()

TextBox1 = ComboBox1.Column(1)

End Sub

I have a userform with a combobox 1,a text box 1and a command button(fetch)
I want sheet1! A2 to last used cell in Col A as combobox 1 values.
If a a value is selected from combox list ,and click fetch command button,
then vlookup that value from sheet1A2:F200,from column 5 fetch to textbox1.
what code I have to add to userform code module for above 2 tasks.
Thanks in advance to all Vba experts.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200905/1

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
fetch values from w/sheet TUNGANA KURMA RAJU Excel Discussion (Misc queries) 0 April 2nd 09 03:43 AM
Using browser to login and fetch CSV NMG Excel Programming 0 April 28th 08 03:43 PM
Fetch Autofilter options ashish128 Excel Programming 1 October 11th 07 12:24 PM
Fetch Text From Website Dileep Chandran Excel Programming 5 March 22nd 07 04:24 PM
Use 1 userform for many sheets, Rather than 1 userform per sheet: How? Corey Excel Programming 3 November 30th 06 06:44 AM


All times are GMT +1. The time now is 11:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"