PC Review


Reply
Thread Tools Rate Thread

Display all cells values of that row from where a cell value retri

 
 
Msgbox Data not found
Guest
Posts: n/a
 
      18th Feb 2010
Hi All,

I'm a baby to Excel Programming.

But I've to programme Excel 2003 work book in order that if sth is typed in
the text box control. The code searches all the worksheets and displays the
value in the label control.
I've a textbox control, label control and a command button control in Sheet 1

Now with the below mentioned codes I suceeded to retrieve a cell value in a
lable control. But the problem is, I've no idea to display all the cells
value of that from where the cell in a row, a data was retrieved.

Any Idea!!

Please Help!! SOS Please consider!!

Private Sub cmdbtn1_Click()
Dim Sh As Worksheet
Dim FoundIt As Boolean
d = "A1: A5000"
Let c = txtbx1.Value

For Each Sh In ActiveWorkbook.Worksheets
With Sh.Range(d)
Set b = .Find(c, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
If c = "" Then
MsgBox "You haven't typed anything in the Search Box"
Exit Sub

ElseIf Not b Is Nothing Then
firstAddress = b.Address
lbl1.Caption = b

Do
txtbx2.Value = c
Set b = .FindNext(b)
FoundIt = True
Loop While Not b Is Nothing And b.Address <> firstAddress
End If
End With

Next
If Not (FoundIt) Then
MsgBox "Data not found!!"
End If

End Sub



 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      18th Feb 2010
What are you trying to display?

The addresses of all the found cells in all the worksheets in A1:A5000?

The values of some column on the same rows of all the found cells?

Since you're looping through all the worksheets and finding lots (maybe) on each
sheet, I'm confused.

Msgbox "Data not found" wrote:
>
> Hi All,
>
> I'm a baby to Excel Programming.
>
> But I've to programme Excel 2003 work book in order that if sth is typed in
> the text box control. The code searches all the worksheets and displays the
> value in the label control.
> I've a textbox control, label control and a command button control in Sheet 1
>
> Now with the below mentioned codes I suceeded to retrieve a cell value in a
> lable control. But the problem is, I've no idea to display all the cells
> value of that from where the cell in a row, a data was retrieved.
>
> Any Idea!!
>
> Please Help!! SOS Please consider!!
>
> Private Sub cmdbtn1_Click()
> Dim Sh As Worksheet
> Dim FoundIt As Boolean
> d = "A1: A5000"
> Let c = txtbx1.Value
>
> For Each Sh In ActiveWorkbook.Worksheets
> With Sh.Range(d)
> Set b = .Find(c, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
> If c = "" Then
> MsgBox "You haven't typed anything in the Search Box"
> Exit Sub
>
> ElseIf Not b Is Nothing Then
> firstAddress = b.Address
> lbl1.Caption = b
>
> Do
> txtbx2.Value = c
> Set b = .FindNext(b)
> FoundIt = True
> Loop While Not b Is Nothing And b.Address <> firstAddress
> End If
> End With
>
> Next
> If Not (FoundIt) Then
> MsgBox "Data not found!!"
> End If
>
> End Sub


--

Dave Peterson
 
Reply With Quote
 
Msgbox Data not found
Guest
Posts: n/a
 
      19th Feb 2010
Dear Dave,

Appreciate for your response!!

For instance if my code detects a required data in a cell A1 of Sheet 2. so
I would like the workbook to be programmed to display the succeeding data in
the same row from A1 to H1. No matter if I have to place different label
controls for each column.

"Dave Peterson" wrote:

> What are you trying to display?
>
> The addresses of all the found cells in all the worksheets in A1:A5000?
>
> The values of some column on the same rows of all the found cells?
>
> Since you're looping through all the worksheets and finding lots (maybe) on each
> sheet, I'm confused.
>
> Msgbox "Data not found" wrote:
> >
> > Hi All,
> >
> > I'm a baby to Excel Programming.
> >
> > But I've to programme Excel 2003 work book in order that if sth is typed in
> > the text box control. The code searches all the worksheets and displays the
> > value in the label control.
> > I've a textbox control, label control and a command button control in Sheet 1
> >
> > Now with the below mentioned codes I suceeded to retrieve a cell value in a
> > lable control. But the problem is, I've no idea to display all the cells
> > value of that from where the cell in a row, a data was retrieved.
> >
> > Any Idea!!
> >
> > Please Help!! SOS Please consider!!
> >
> > Private Sub cmdbtn1_Click()
> > Dim Sh As Worksheet
> > Dim FoundIt As Boolean
> > d = "A1: A5000"
> > Let c = txtbx1.Value
> >
> > For Each Sh In ActiveWorkbook.Worksheets
> > With Sh.Range(d)
> > Set b = .Find(c, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
> > If c = "" Then
> > MsgBox "You haven't typed anything in the Search Box"
> > Exit Sub
> >
> > ElseIf Not b Is Nothing Then
> > firstAddress = b.Address
> > lbl1.Caption = b
> >
> > Do
> > txtbx2.Value = c
> > Set b = .FindNext(b)
> > FoundIt = True
> > Loop While Not b Is Nothing And b.Address <> firstAddress
> > End If
> > End With
> >
> > Next
> > If Not (FoundIt) Then
> > MsgBox "Data not found!!"
> > End If
> >
> > End Sub

>
> --
>
> Dave Peterson
> .
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      19th Feb 2010
Does this mean that you want exactly one item--the first match found displayed?

Or if you find a 32,325 matches on all 3,652 sheets, then you'd want all 32,325
matches (A:H) displayed?

(And why would you want the data from column A displayed--that's the field
you're matching on and it's shown in your label?)

Msgbox "Data not found" wrote:
>
> Dear Dave,
>
> Appreciate for your response!!
>
> For instance if my code detects a required data in a cell A1 of Sheet 2. so
> I would like the workbook to be programmed to display the succeeding data in
> the same row from A1 to H1. No matter if I have to place different label
> controls for each column.
>
> "Dave Peterson" wrote:
>
> > What are you trying to display?
> >
> > The addresses of all the found cells in all the worksheets in A1:A5000?
> >
> > The values of some column on the same rows of all the found cells?
> >
> > Since you're looping through all the worksheets and finding lots (maybe) on each
> > sheet, I'm confused.
> >
> > Msgbox "Data not found" wrote:
> > >
> > > Hi All,
> > >
> > > I'm a baby to Excel Programming.
> > >
> > > But I've to programme Excel 2003 work book in order that if sth is typed in
> > > the text box control. The code searches all the worksheets and displays the
> > > value in the label control.
> > > I've a textbox control, label control and a command button control in Sheet 1
> > >
> > > Now with the below mentioned codes I suceeded to retrieve a cell value in a
> > > lable control. But the problem is, I've no idea to display all the cells
> > > value of that from where the cell in a row, a data was retrieved.
> > >
> > > Any Idea!!
> > >
> > > Please Help!! SOS Please consider!!
> > >
> > > Private Sub cmdbtn1_Click()
> > > Dim Sh As Worksheet
> > > Dim FoundIt As Boolean
> > > d = "A1: A5000"
> > > Let c = txtbx1.Value
> > >
> > > For Each Sh In ActiveWorkbook.Worksheets
> > > With Sh.Range(d)
> > > Set b = .Find(c, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
> > > If c = "" Then
> > > MsgBox "You haven't typed anything in the Search Box"
> > > Exit Sub
> > >
> > > ElseIf Not b Is Nothing Then
> > > firstAddress = b.Address
> > > lbl1.Caption = b
> > >
> > > Do
> > > txtbx2.Value = c
> > > Set b = .FindNext(b)
> > > FoundIt = True
> > > Loop While Not b Is Nothing And b.Address <> firstAddress
> > > End If
> > > End With
> > >
> > > Next
> > > If Not (FoundIt) Then
> > > MsgBox "Data not found!!"
> > > End If
> > >
> > > End Sub

> >
> > --
> >
> > Dave Peterson
> > .
> >


--

Dave Peterson
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      19th Feb 2010
ps.

You may want to look at Jan Karel Pieterse's FlexFind:
http://www.jkp-ads.com/OfficeMarketPlaceFF-EN.asp

It doesn't quite do all what you want, but it's very powerful.

Msgbox "Data not found" wrote:
>
> Dear Dave,
>
> Appreciate for your response!!
>
> For instance if my code detects a required data in a cell A1 of Sheet 2. so
> I would like the workbook to be programmed to display the succeeding data in
> the same row from A1 to H1. No matter if I have to place different label
> controls for each column.
>
> "Dave Peterson" wrote:
>
> > What are you trying to display?
> >
> > The addresses of all the found cells in all the worksheets in A1:A5000?
> >
> > The values of some column on the same rows of all the found cells?
> >
> > Since you're looping through all the worksheets and finding lots (maybe) on each
> > sheet, I'm confused.
> >
> > Msgbox "Data not found" wrote:
> > >
> > > Hi All,
> > >
> > > I'm a baby to Excel Programming.
> > >
> > > But I've to programme Excel 2003 work book in order that if sth is typed in
> > > the text box control. The code searches all the worksheets and displays the
> > > value in the label control.
> > > I've a textbox control, label control and a command button control in Sheet 1
> > >
> > > Now with the below mentioned codes I suceeded to retrieve a cell value in a
> > > lable control. But the problem is, I've no idea to display all the cells
> > > value of that from where the cell in a row, a data was retrieved.
> > >
> > > Any Idea!!
> > >
> > > Please Help!! SOS Please consider!!
> > >
> > > Private Sub cmdbtn1_Click()
> > > Dim Sh As Worksheet
> > > Dim FoundIt As Boolean
> > > d = "A1: A5000"
> > > Let c = txtbx1.Value
> > >
> > > For Each Sh In ActiveWorkbook.Worksheets
> > > With Sh.Range(d)
> > > Set b = .Find(c, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
> > > If c = "" Then
> > > MsgBox "You haven't typed anything in the Search Box"
> > > Exit Sub
> > >
> > > ElseIf Not b Is Nothing Then
> > > firstAddress = b.Address
> > > lbl1.Caption = b
> > >
> > > Do
> > > txtbx2.Value = c
> > > Set b = .FindNext(b)
> > > FoundIt = True
> > > Loop While Not b Is Nothing And b.Address <> firstAddress
> > > End If
> > > End With
> > >
> > > Next
> > > If Not (FoundIt) Then
> > > MsgBox "Data not found!!"
> > > End If
> > >
> > > End Sub

> >
> > --
> >
> > Dave Peterson
> > .
> >


--

Dave Peterson
 
Reply With Quote
 
Msgbox Data not found
Guest
Posts: n/a
 
      22nd Feb 2010
No, No, No, Whatever I have thought, may appear simple. for instance: My
search is concerned with three characters text or number. If my program finds
IND in sheet 3, my code displays IND only in the Label control at present. I
want the discriptions in the succeeding columns to be displayed in different
labels control. For example: A1 = IND, B1 = INDIA, C1 = ASIA, D1 = Largest
Democratic Country, E1 = Hindu etc.

Is it impossible?



"Dave Peterson" wrote:

> ps.
>
> You may want to look at Jan Karel Pieterse's FlexFind:
> http://www.jkp-ads.com/OfficeMarketPlaceFF-EN.asp
>
> It doesn't quite do all what you want, but it's very powerful.
>
> Msgbox "Data not found" wrote:
> >
> > Dear Dave,
> >
> > Appreciate for your response!!
> >
> > For instance if my code detects a required data in a cell A1 of Sheet 2. so
> > I would like the workbook to be programmed to display the succeeding data in
> > the same row from A1 to H1. No matter if I have to place different label
> > controls for each column.
> >
> > "Dave Peterson" wrote:
> >
> > > What are you trying to display?
> > >
> > > The addresses of all the found cells in all the worksheets in A1:A5000?
> > >
> > > The values of some column on the same rows of all the found cells?
> > >
> > > Since you're looping through all the worksheets and finding lots (maybe) on each
> > > sheet, I'm confused.
> > >
> > > Msgbox "Data not found" wrote:
> > > >
> > > > Hi All,
> > > >
> > > > I'm a baby to Excel Programming.
> > > >
> > > > But I've to programme Excel 2003 work book in order that if sth is typed in
> > > > the text box control. The code searches all the worksheets and displays the
> > > > value in the label control.
> > > > I've a textbox control, label control and a command button control in Sheet 1
> > > >
> > > > Now with the below mentioned codes I suceeded to retrieve a cell value in a
> > > > lable control. But the problem is, I've no idea to display all the cells
> > > > value of that from where the cell in a row, a data was retrieved.
> > > >
> > > > Any Idea!!
> > > >
> > > > Please Help!! SOS Please consider!!
> > > >
> > > > Private Sub cmdbtn1_Click()
> > > > Dim Sh As Worksheet
> > > > Dim FoundIt As Boolean
> > > > d = "A1: A5000"
> > > > Let c = txtbx1.Value
> > > >
> > > > For Each Sh In ActiveWorkbook.Worksheets
> > > > With Sh.Range(d)
> > > > Set b = .Find(c, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
> > > > If c = "" Then
> > > > MsgBox "You haven't typed anything in the Search Box"
> > > > Exit Sub
> > > >
> > > > ElseIf Not b Is Nothing Then
> > > > firstAddress = b.Address
> > > > lbl1.Caption = b
> > > >
> > > > Do
> > > > txtbx2.Value = c
> > > > Set b = .FindNext(b)
> > > > FoundIt = True
> > > > Loop While Not b Is Nothing And b.Address <> firstAddress
> > > > End If
> > > > End With
> > > >
> > > > Next
> > > > If Not (FoundIt) Then
> > > > MsgBox "Data not found!!"
> > > > End If
> > > >
> > > > End Sub
> > >
> > > --
> > >
> > > Dave Peterson
> > > .
> > >

>
> --
>
> Dave Peterson
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine and display values in range in 1 cell but skip blank cells Swiss Microsoft Excel Worksheet Functions 3 4th Sep 2009 10:00 PM
some cells display formulas, some display values mvivelo Microsoft Excel Misc 0 27th Mar 2008 09:58 PM
Display all values in other cells with no duplicates =?Utf-8?B?U2h1IG9mIEFa?= Microsoft Excel Misc 0 9th Nov 2007 01:00 AM
Shortcut key to display change the display from displaying cell values to cell formulae =?Utf-8?B?QUEyZTcyRQ==?= Microsoft Excel Programming 3 14th Sep 2004 12:07 PM
how to display values in 3 cells into one cell William Poh Ben Microsoft Excel Misc 2 31st Aug 2003 01:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:06 PM.