#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Change Color of Cell

Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String
Dim wksDestination As Worksheet
Dim rngDestination As Range
Code below finds a column with value A and pastes it in worksheet
output. How do I change the color of the cell when it pastes the
output?

Set wksDestination = Sheets("Output")
Set rngDestination = wksDestination.Range("A1")
Set wksToSearch = Sheets("Master Questions")
Set rngToSearch = wksToSearch.Columns("B")
Set rngFound = rngToSearch.Find(What:="A", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry. Not found"
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Offset(0, -1).Copy rngDestination

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Change Color of Cell

Add

rngDestination.Interior.Colorindex -3

which colours it red.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RigasMinho" wrote in message
ups.com...
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String
Dim wksDestination As Worksheet
Dim rngDestination As Range
Code below finds a column with value A and pastes it in worksheet
output. How do I change the color of the cell when it pastes the
output?

Set wksDestination = Sheets("Output")
Set rngDestination = wksDestination.Range("A1")
Set wksToSearch = Sheets("Master Questions")
Set rngToSearch = wksToSearch.Columns("B")
Set rngFound = rngToSearch.Find(What:="A", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry. Not found"
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Offset(0, -1).Copy rngDestination



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Change Color of Cell


Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Offset(0, -1).Copy rngDestination
rngDestination.Interior.ColorIndex = 3

only changes the first cell - i want it so that it changes all the
cells in the out.

Anyone?
Bob Phillips wrote:
Add

rngDestination.Interior.Colorindex -3

which colours it red.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RigasMinho" wrote in message
ups.com...
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String
Dim wksDestination As Worksheet
Dim rngDestination As Range
Code below finds a column with value A and pastes it in worksheet
output. How do I change the color of the cell when it pastes the
output?

Set wksDestination = Sheets("Output")
Set rngDestination = wksDestination.Range("A1")
Set wksToSearch = Sheets("Master Questions")
Set rngToSearch = wksToSearch.Columns("B")
Set rngFound = rngToSearch.Find(What:="A", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry. Not found"
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Offset(0, -1).Copy rngDestination


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Change Color of Cell

rngDestination.Resize(rngFoundAll.Cells.Count).Int erior.ColorIndex =
3

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RigasMinho" wrote in message
oups.com...

Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Offset(0, -1).Copy rngDestination
rngDestination.Interior.ColorIndex = 3

only changes the first cell - i want it so that it changes all the
cells in the out.

Anyone?
Bob Phillips wrote:
Add

rngDestination.Interior.Colorindex -3

which colours it red.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RigasMinho" wrote in message
ups.com...
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String
Dim wksDestination As Worksheet
Dim rngDestination As Range
Code below finds a column with value A and pastes it in worksheet
output. How do I change the color of the cell when it pastes the
output?

Set wksDestination = Sheets("Output")
Set rngDestination = wksDestination.Range("A1")
Set wksToSearch = Sheets("Master Questions")
Set rngToSearch = wksToSearch.Columns("B")
Set rngFound = rngToSearch.Find(What:="A", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry. Not found"
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Offset(0, -1).Copy rngDestination




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
insert date Larry Excel Worksheet Functions 28 July 15th 06 02:41 AM
I Need a formula to evaluate a cell with + or - values Bob in Oklahoma Excel Worksheet Functions 6 October 31st 05 02:41 PM
Cell Change Color - Need Help alani New Users to Excel 3 June 29th 05 03:50 PM
Cell references change when entering new data [email protected] New Users to Excel 2 May 6th 05 07:48 PM
Look for change next blank cell in Range Nigel Bennett Excel Worksheet Functions 1 March 13th 05 09:45 PM


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