Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Seclect Column or Range according to Cell's Contents

I need a VBA macro to do the following

I have to search for a specific word say "Sunday" within a range (A7:AJ7).
When the word is found, the column containing the cell with the word
"Sunday", or a special range within the column should be shaded.

Any help would be much appreciated

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Seclect Column or Range according to Cell's Contents

Dim oCell As Range
With Range("A7:AJ7")
Set oCell = .Find("Sunday", LookIn:=xlValues)
If Not oCell Is Nothing Then
oCell.EntireColumn.Select
End If
End With


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Nora N" <Nora wrote in message
...
I need a VBA macro to do the following

I have to search for a specific word say "Sunday" within a range (A7:AJ7).
When the word is found, the column containing the cell with the word
"Sunday", or a special range within the column should be shaded.

Any help would be much appreciated



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Seclect Column or Range according to Cell's Contents

Thank you Bob, However, I still need further assistance

What I actualy need is when the word "Sunday" is founded in a cell within
the range A7:AJ7(Suppose H7) I want range H8:H30 to be shaded in Gray.

Thank you

"Nora N" wrote:

I need a VBA macro to do the following

I have to search for a specific word say "Sunday" within a range (A7:AJ7).
When the word is found, the column containing the cell with the word
"Sunday", or a special range within the column should be shaded.

Any help would be much appreciated

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Seclect Column or Range according to Cell's Contents

Dim oCell As Range
With Range("A7:AJ7")
Set oCell = .Find("Sunday", LookIn:=xlValues)
If Not oCell Is Nothing Then
oCell.Offset(1,0).Resize(30 - oCell.Row).Interior.Colorindex =
15
End If
End With

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Nora N" wrote in message
...
Thank you Bob, However, I still need further assistance

What I actualy need is when the word "Sunday" is founded in a cell within
the range A7:AJ7(Suppose H7) I want range H8:H30 to be shaded in Gray.

Thank you

"Nora N" wrote:

I need a VBA macro to do the following

I have to search for a specific word say "Sunday" within a range

(A7:AJ7).
When the word is found, the column containing the cell with the word
"Sunday", or a special range within the column should be shaded.

Any help would be much appreciated



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
Using cell's contents as an index to a row ... ? Mac Excel Worksheet Functions 1 February 14th 09 12:07 AM
link to a cell's contents bluezcruizer Excel Worksheet Functions 1 December 3rd 06 12:49 PM
link to a cell's contents CLR Excel Worksheet Functions 0 November 30th 06 03:17 PM
How do I make a cell's contents equal to another cell's contents with macro program? mgmcdevitt[_10_] Excel Programming 2 September 15th 05 09:44 PM
Can I select a range based on the cell's contents? [email protected] Excel Programming 1 July 29th 05 11:08 AM


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