Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default copy contents including colour

Hi
In cells A1:B73 I have a list of contacts which are colour coded. What I
want to be able to do is to be able to enter the name of 1 of the contacts in
lets say G1 and it will search for that name in A1:B73 and automatically copy
its colour code over.
Many thanks for any help.
Al
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default copy contents including colour

Hi,

I'm assuming that the colour codeing isn't a result of conditional
formatting and it's simply a fill colour. To do this you need VB.

Alt+F11 to open vb editor. Double click the worksheet that this data are on
and paste the code in on the right. Close VB editor and type your name in G1
and your away.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$G$1" Then
Application.EnableEvents = False
On Error GoTo GetMeOut
Set rfound = Range("A1:B73").Find(What:=Target.Value,
After:=Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
Target.Interior.ColorIndex = rfound.Interior.ColorIndex
Application.EnableEvents = True
End If
Exit Sub
GetMeOut:
MsgBox "Lookup no found"
Target.Interior.ColorIndex = xlNone
Application.EnableEvents = True
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"gramps" wrote:

Hi
In cells A1:B73 I have a list of contacts which are colour coded. What I
want to be able to do is to be able to enter the name of 1 of the contacts in
lets say G1 and it will search for that name in A1:B73 and automatically copy
its colour code over.
Many thanks for any help.
Al

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default copy contents including colour

Thanks Mike that's bang on the money!!Al

"Mike H" wrote:

Hi,

I'm assuming that the colour codeing isn't a result of conditional
formatting and it's simply a fill colour. To do this you need VB.

Alt+F11 to open vb editor. Double click the worksheet that this data are on
and paste the code in on the right. Close VB editor and type your name in G1
and your away.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$G$1" Then
Application.EnableEvents = False
On Error GoTo GetMeOut
Set rfound = Range("A1:B73").Find(What:=Target.Value,
After:=Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
Target.Interior.ColorIndex = rfound.Interior.ColorIndex
Application.EnableEvents = True
End If
Exit Sub
GetMeOut:
MsgBox "Lookup no found"
Target.Interior.ColorIndex = xlNone
Application.EnableEvents = True
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"gramps" wrote:

Hi
In cells A1:B73 I have a list of contacts which are colour coded. What I
want to be able to do is to be able to enter the name of 1 of the contacts in
lets say G1 and it will search for that name in A1:B73 and automatically copy
its colour code over.
Many thanks for any help.
Al

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default copy contents including colour

Glad I could help and thanks for the feedback
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"gramps" wrote:

Thanks Mike that's bang on the money!!Al

"Mike H" wrote:

Hi,

I'm assuming that the colour codeing isn't a result of conditional
formatting and it's simply a fill colour. To do this you need VB.

Alt+F11 to open vb editor. Double click the worksheet that this data are on
and paste the code in on the right. Close VB editor and type your name in G1
and your away.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$G$1" Then
Application.EnableEvents = False
On Error GoTo GetMeOut
Set rfound = Range("A1:B73").Find(What:=Target.Value,
After:=Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
Target.Interior.ColorIndex = rfound.Interior.ColorIndex
Application.EnableEvents = True
End If
Exit Sub
GetMeOut:
MsgBox "Lookup no found"
Target.Interior.ColorIndex = xlNone
Application.EnableEvents = True
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"gramps" wrote:

Hi
In cells A1:B73 I have a list of contacts which are colour coded. What I
want to be able to do is to be able to enter the name of 1 of the contacts in
lets say G1 and it will search for that name in A1:B73 and automatically copy
its colour code over.
Many thanks for any help.
Al

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
Copy cell contents depending on font colour alistew Excel Worksheet Functions 0 May 11th 09 04:22 PM
How do i change the colour of a cell according to the contents? ChrisC Excel Discussion (Misc queries) 2 October 10th 08 09:58 PM
excel - formula to copy the cell contents and colour. Possible? Jason Excel Discussion (Misc queries) 3 August 24th 07 10:05 PM
Changing Cell Contents Colour Spiller Excel Discussion (Misc queries) 3 November 24th 06 01:40 PM
Referencing a cell including background colour... neilcarden Excel Worksheet Functions 1 August 3rd 06 01:46 PM


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