Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Showing rows containing text

I have figured out how to search rows in a worksheet and display only rows
that contain text that matches the users input (the code is below). What I am
not able to figure out is how to display rows with text containing text that
the user inputs into the inputbox. I tried putting the * in front of the text
in the inputbox but that does not work. Any help would be greatly appreciated.

Dim r As Range
ActiveWorkbook.Worksheets(1).Range("A1").Select
v = UCase(Application.InputBox("Enter Course Number:", "Course", Type:=2))
Rows.Range("Courses").EntireRow.Hidden = True

For Each r In ActiveSheet.UsedRange
If InStr(r.Value, v) < 0 Then
Rows(r.Row).EntireRow.Hidden = False
End If
Next
Cells(1, 1).Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Showing rows containing text

Billy,

I'm not quite sure what it is you are trying to do.

Do you want a combo/list box for the user to select the course?

If so it may be easier to use auto filter on the table as the user can pull
that down.

Please explain a little more.

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Billy B" wrote:

I have figured out how to search rows in a worksheet and display only rows
that contain text that matches the users input (the code is below). What I am
not able to figure out is how to display rows with text containing text that
the user inputs into the inputbox. I tried putting the * in front of the text
in the inputbox but that does not work. Any help would be greatly appreciated.

Dim r As Range
ActiveWorkbook.Worksheets(1).Range("A1").Select
v = UCase(Application.InputBox("Enter Course Number:", "Course", Type:=2))
Rows.Range("Courses").EntireRow.Hidden = True

For Each r In ActiveSheet.UsedRange
If InStr(r.Value, v) < 0 Then
Rows(r.Row).EntireRow.Hidden = False
End If
Next
Cells(1, 1).Select
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Showing rows containing text

The user inputs a word into an inputbox, all rows are hidden then the loop
unhides those rows that contain the word typed in the inputbox. Hope that
helps.

"Martin Fishlock" wrote:

Billy,

I'm not quite sure what it is you are trying to do.

Do you want a combo/list box for the user to select the course?

If so it may be easier to use auto filter on the table as the user can pull
that down.

Please explain a little more.

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Billy B" wrote:

I have figured out how to search rows in a worksheet and display only rows
that contain text that matches the users input (the code is below). What I am
not able to figure out is how to display rows with text containing text that
the user inputs into the inputbox. I tried putting the * in front of the text
in the inputbox but that does not work. Any help would be greatly appreciated.

Dim r As Range
ActiveWorkbook.Worksheets(1).Range("A1").Select
v = UCase(Application.InputBox("Enter Course Number:", "Course", Type:=2))
Rows.Range("Courses").EntireRow.Hidden = True

For Each r In ActiveSheet.UsedRange
If InStr(r.Value, v) < 0 Then
Rows(r.Row).EntireRow.Hidden = False
End If
Next
Cells(1, 1).Select
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Showing rows containing text

Billy,

I was really asking about the * and the input text.

But your macro seems to work for me. The only area that may be a problem is
your range definition of courses.

You hide the range course but check theused range.

I don't undestand where the problem is.

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Billy B" wrote:

The user inputs a word into an inputbox, all rows are hidden then the loop
unhides those rows that contain the word typed in the inputbox. Hope that
helps.

"Martin Fishlock" wrote:

Billy,

I'm not quite sure what it is you are trying to do.

Do you want a combo/list box for the user to select the course?

If so it may be easier to use auto filter on the table as the user can pull
that down.

Please explain a little more.

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Billy B" wrote:

I have figured out how to search rows in a worksheet and display only rows
that contain text that matches the users input (the code is below). What I am
not able to figure out is how to display rows with text containing text that
the user inputs into the inputbox. I tried putting the * in front of the text
in the inputbox but that does not work. Any help would be greatly appreciated.

Dim r As Range
ActiveWorkbook.Worksheets(1).Range("A1").Select
v = UCase(Application.InputBox("Enter Course Number:", "Course", Type:=2))
Rows.Range("Courses").EntireRow.Hidden = True

For Each r In ActiveSheet.UsedRange
If InStr(r.Value, v) < 0 Then
Rows(r.Row).EntireRow.Hidden = False
End If
Next
Cells(1, 1).Select
End Sub

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
Showing all rows in a pivot table [email protected] Excel Discussion (Misc queries) 2 April 25th 09 04:51 PM
Showing only rows with data Shaz Excel Discussion (Misc queries) 2 February 16th 06 04:32 AM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM
Showing Duplicate Rows EaglesNest Excel Discussion (Misc queries) 4 March 26th 05 05:21 PM
Macro showing just certain rows sebastienm Excel Programming 0 August 10th 04 05:47 PM


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