Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Combining lists (again)

I have 2 spreadsheets with identical data. In column B of RED.XLS, certain
items are highlighted in red text. In the same column of GREEN.XLS, certain
other items are highlighted in green text. Some items are highlighted in
both spreadsheets.

In COMBINED.XLS, I have another copy of the column B data. There I want to
highlight in red any item which is highlighted in either RED.XLS or
GREEN.XLS. I also want to identify the data items which are highlighted in
both of the other spreadsheets, by changing the background color of the cell
to the right of the cell concerned.

The following code crashes at this line, and I can't see why:

WS3.Range(Cell.Offset(0, 1)).Interior.Color = 5

What am I doing wrong?

I am using XL97 on W2000.

Sub RedAndGreen()
' 12/9/04
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim WS3 As Worksheet
Dim Cell As Range
Set WS1 = Workbooks(" red.xls").ActiveSheet
Set WS2 = Workbooks("green.xls").ActiveSheet
Set WS3 = Workbooks("combined.xls").ActiveSheet
For Each Cell In WS1.Columns(2).SpecialCells(xlCellTypeFormulas)
If Cell.Font.ColorIndex = 3 Then
If WS2.Range(Cell.Address).Font.ColorIndex = 4 Then
WS3.Range(Cell.Offset(0, 1)).Interior.Color = 5
Else: WS3.Range(Cell.Address).Font.ColorIndex = 3
End If
End If
Next
For Each Cell In WS2.Columns(2).SpecialCells(xlCellTypeFormulas)
If Cell.Font.ColorIndex = 4 Then
WS3.Range(Cell.Address).Font.ColorIndex = 3
End If
Next
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Combining lists (again)

Maybe you wanted:

WS3.Range(Cell.Offset(0, 1).address).Interior.Color = 5



Brian wrote:

I have 2 spreadsheets with identical data. In column B of RED.XLS, certain
items are highlighted in red text. In the same column of GREEN.XLS, certain
other items are highlighted in green text. Some items are highlighted in
both spreadsheets.

In COMBINED.XLS, I have another copy of the column B data. There I want to
highlight in red any item which is highlighted in either RED.XLS or
GREEN.XLS. I also want to identify the data items which are highlighted in
both of the other spreadsheets, by changing the background color of the cell
to the right of the cell concerned.

The following code crashes at this line, and I can't see why:

WS3.Range(Cell.Offset(0, 1)).Interior.Color = 5

What am I doing wrong?

I am using XL97 on W2000.

Sub RedAndGreen()
' 12/9/04
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim WS3 As Worksheet
Dim Cell As Range
Set WS1 = Workbooks(" red.xls").ActiveSheet
Set WS2 = Workbooks("green.xls").ActiveSheet
Set WS3 = Workbooks("combined.xls").ActiveSheet
For Each Cell In WS1.Columns(2).SpecialCells(xlCellTypeFormulas)
If Cell.Font.ColorIndex = 3 Then
If WS2.Range(Cell.Address).Font.ColorIndex = 4 Then
WS3.Range(Cell.Offset(0, 1)).Interior.Color = 5
Else: WS3.Range(Cell.Address).Font.ColorIndex = 3
End If
End If
Next
For Each Cell In WS2.Columns(2).SpecialCells(xlCellTypeFormulas)
If Cell.Font.ColorIndex = 4 Then
WS3.Range(Cell.Address).Font.ColorIndex = 3
End If
Next
End Sub


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Combining lists (again)

Many thanks.

"Dave Peterson" wrote in message
...
Maybe you wanted:

WS3.Range(Cell.Offset(0, 1).address).Interior.Color = 5



Brian wrote:

I have 2 spreadsheets with identical data. In column B of RED.XLS,

certain
items are highlighted in red text. In the same column of GREEN.XLS,

certain
other items are highlighted in green text. Some items are highlighted in
both spreadsheets.

In COMBINED.XLS, I have another copy of the column B data. There I want

to
highlight in red any item which is highlighted in either RED.XLS or
GREEN.XLS. I also want to identify the data items which are highlighted

in
both of the other spreadsheets, by changing the background color of the

cell
to the right of the cell concerned.

The following code crashes at this line, and I can't see why:

WS3.Range(Cell.Offset(0, 1)).Interior.Color = 5

What am I doing wrong?

I am using XL97 on W2000.

Sub RedAndGreen()
' 12/9/04
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim WS3 As Worksheet
Dim Cell As Range
Set WS1 = Workbooks(" red.xls").ActiveSheet
Set WS2 = Workbooks("green.xls").ActiveSheet
Set WS3 = Workbooks("combined.xls").ActiveSheet
For Each Cell In WS1.Columns(2).SpecialCells(xlCellTypeFormulas)
If Cell.Font.ColorIndex = 3 Then
If WS2.Range(Cell.Address).Font.ColorIndex = 4 Then
WS3.Range(Cell.Offset(0, 1)).Interior.Color = 5
Else: WS3.Range(Cell.Address).Font.ColorIndex = 3
End If
End If
Next
For Each Cell In WS2.Columns(2).SpecialCells(xlCellTypeFormulas)
If Cell.Font.ColorIndex = 4 Then
WS3.Range(Cell.Address).Font.ColorIndex = 3
End If
Next
End Sub


--

Dave Peterson



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
combining several lists into one? Omics Excel Discussion (Misc queries) 1 March 19th 09 04:25 PM
Combining 2 lists [email protected] Excel Discussion (Misc queries) 5 October 11th 08 12:50 PM
Help with combining lists lblunier Excel Worksheet Functions 1 July 23rd 08 08:56 PM
combining two lists karmaisgreat Excel Worksheet Functions 3 April 13th 06 09:16 PM
Combining 2 lists stevenrhonda New Users to Excel 1 March 5th 06 10:42 PM


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