Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2006, 04:01 AM
ct ct is offline
Authorized User
 
Join Date: Aug 2005
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default matching the output and displaying the data

i try to write the coding for search button...
but i my case the output just select only one row..how i want to display the output for and match the data?

Private Sub CommandButton1_Click()
Dim response
Dim i As Integer

i = 2

'Find the value in worksheet based on the string of text box
Do While Worksheets("Sheet1").Cells(i, 2).Value <> ComboBox1.Text
    i = i + 1

    'Generate msg box if the value does not found
    If IsEmpty(Worksheets("Sheet1").Cells(i, 2).Value) = True Then
        response = MsgBox("DATA NOT FOUND...!!!", vbInformation, "Warning...!!!")
        'Clearing text boxes after warning msg box
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        Exit Do
    End If
Loop

'Set each text boxes with the found value from worksheet
If Worksheets("Sheet1").Cells(i, 2).Value = ComboBox1.Text Then
    TextBox1.Text = Worksheets("Sheet1").Cells(i, 1).Value
    TextBox2.Text = Worksheets("sheet1").Cells(i, 2).Value
    TextBox3.Text = Worksheets("sheet1").Cells(i, 3).Value
    TextBox4.Text = Worksheets("Sheet1").Cells(i, 4).Value
    TextBox5.Text = Worksheets("sheet1").Cells(i, 5).Value
    TextBox6.Text = Worksheets("sheet1").Cells(i, 6).Value

End If
End Sub






Similar Threads
Thread Thread Starter Forum Replies Last Post
data output kciwzehc Access 5 November 28th, 2007 01:10 PM
About output data to excel momowu0701 Beginning VB 6 0 March 1st, 2005 09:31 AM
Displaying output in Excel via ASP Sach Classic ASP Components 4 May 3rd, 2004 07:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.