Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Search in Range

Hi All,

I have a workbook with several sheets.
Column (J2:J65536.end(xlup))is named as RecNo except in
the first two and last two sheets.
I want to search all sheets except the first two sheets
and last two sheets for a value in combobox1 in userform1
and if found i want to add the sheet name (s) in listbox1

How can I accoplish this

Thanks in advance
Soniya

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Search in Range

Hi Soniya,

Try this code

Dim cell As Range
Dim rng As Range
Dim sh As Worksheet

For Each sh In ActiveWorkbook.Worksheets
On Error Resume Next
Set rng = sh.Range("RecNo")
If Not rng Is Nothing Then
Set cell = sh.Cells.Find(ComboBox1.Value)
If Not cell Is Nothing Then
Me.ListBox1.AddItem sh.Name
End If
End If
Set rng = Nothing
Set cell = Nothing
On Error GoTo 0
Next sh
With Me.ListBox1
If .ListCount 0 Then
.ListIndex = 0
End If
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Soniya" wrote in message
...
Hi All,

I have a workbook with several sheets.
Column (J2:J65536.end(xlup))is named as RecNo except in
the first two and last two sheets.
I want to search all sheets except the first two sheets
and last two sheets for a value in combobox1 in userform1
and if found i want to add the sheet name (s) in listbox1

How can I accoplish this

Thanks in advance
Soniya



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
Search range johnrb7865 Excel Worksheet Functions 10 September 11th 08 05:48 PM
Search for value in a range Student Excel Worksheet Functions 6 January 31st 08 12:46 AM
Search range for text not in another range simon howard Excel Discussion (Misc queries) 3 March 28th 07 08:44 PM
Range Search Ray Batig Excel Programming 1 December 23rd 03 09:04 PM
Search for value in a range JC[_5_] Excel Programming 1 August 29th 03 06:36 PM


All times are GMT +1. The time now is 10:57 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"