Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Help with code please?

Hi all,
I am looking for help on this code, I have a userform where it looks up a
number and give the information on the person associated with this number.
Here is the code for this.

Private Sub ComboBox1_Change()
Dim ans

On Error Resume Next


ans = Application.Match(CLng(ComboBox1.Text), Range("A:A"), 0)
If Not IsError(ans) Then
Label1.Caption = Application.Index(Range("b:b"), ans)
Label2.Caption = Application.Index(Range("c:c"), ans)
Else
MsgBox "Invalid code"
End If
On Error GoTo 0

End Sub

I have included a 5 textboxes, textbox1 etc and I want the userform to have
a commandbutton when it is pressed to have the information in the textboxes
to be put in to columns E to I in order textbox1 to "e" etc. I have no
idea how to do this.

Thanks

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Help with code please?

,---------------------------------------------
Private Sub ComboBox1_Change()
Dim ans

On Error Resume Next


ans = Application.Match(CLng(ComboBox1.Text), Range("A:A"), 0)
If Not IsError(ans) Then
Label1.Caption = Cells(ans, "B")
Label2.Caption = Cells(ans, "C")
Else
MsgBox "Invalid code"
End If
On Error GoTo 0

End Sub
'---------------------------------------------

HTH
--
AP

"Greg B" a écrit dans le message de
...
Hi all,
I am looking for help on this code, I have a userform where it looks up a
number and give the information on the person associated with this number.
Here is the code for this.

Private Sub ComboBox1_Change()
Dim ans

On Error Resume Next


ans = Application.Match(CLng(ComboBox1.Text), Range("A:A"), 0)
If Not IsError(ans) Then
Label1.Caption = Application.Index(Range("b:b"), ans)
Label2.Caption = Application.Index(Range("c:c"), ans)
Else
MsgBox "Invalid code"
End If
On Error GoTo 0

End Sub

I have included a 5 textboxes, textbox1 etc and I want the userform to

have
a commandbutton when it is pressed to have the information in the

textboxes
to be put in to columns E to I in order textbox1 to "e" etc. I have no
idea how to do this.

Thanks

Greg




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Help with code please?

Sorry I have reposted it please ignore

greg
"Greg B" wrote in message
...
Hi all,
I am looking for help on this code, I have a userform where it looks up a
number and give the information on the person associated with this number.
Here is the code for this.

Private Sub ComboBox1_Change()
Dim ans

On Error Resume Next


ans = Application.Match(CLng(ComboBox1.Text), Range("A:A"), 0)
If Not IsError(ans) Then
Label1.Caption = Application.Index(Range("b:b"), ans)
Label2.Caption = Application.Index(Range("c:c"), ans)
Else
MsgBox "Invalid code"
End If
On Error GoTo 0

End Sub

I have included a 5 textboxes, textbox1 etc and I want the userform to
have a commandbutton when it is pressed to have the information in the
textboxes to be put in to columns E to I in order textbox1 to "e" etc. I
have no idea how to do this.

Thanks

Greg



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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 09:43 AM.

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"