Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Insert Value based on ColorIndex, for specific range on all sheets

Hello -

Searching through some old posts, I found this code to use
Interior.ColorIndex to assign a value to a cell. I need to modify
this code to apply this logic to all sheets in a workbook, for a
specific range (say A1-Z100) .... OR even better would be to apply to
the 'used' range on each sheet (since it will vary).

TIA, Ray


Sub Macro2()
Dim cell as Range
for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Insert Value based on ColorIndex, for specific range on all sheets

additions don't have

Sub Macro2()
Dim cell as Range

MsgBox ActiveSheet.UsedRange.Address
'you could also try
'MsgBox ActiveSheet.CurrentRegion.Address
'this is just for testing purposes
'to make sure you have the right range.
'& can be deleted once macro
'is working properly
ActiveSheet.UsedRange.Select
for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub


i didn't test this but it should work.
:)
susan

On Mar 20, 7:18 am, "Ray" wrote:
Hello -

Searching through some old posts, I found this code to use
Interior.ColorIndex to assign a value to a cell. I need to modify
this code to apply this logic to all sheets in a workbook, for a
specific range (say A1-Z100) .... OR even better would be to apply to
the 'used' range on each sheet (since it will vary).

TIA, Ray

Sub Macro2()
Dim cell as Range
for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Insert Value based on ColorIndex, for specific range on all sheets

On Mar 20, 8:24 am, "Susan" wrote:
additions don't have

Sub Macro2()
Dim cell as Range


MsgBox ActiveSheet.UsedRange.Address
'you could also try
'MsgBox ActiveSheet.CurrentRegion.Address
'this is just for testing purposes
'to make sure you have the right range.
'& can be deleted once macro
'is working properly
ActiveSheet.UsedRange.Select

for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub


i didn't test this but it should work.
:)
susan

On Mar 20, 7:18 am, "Ray" wrote:

Hello -


Searching through some old posts, I found this code to use
Interior.ColorIndex to assign a value to a cell. I need to modify
this code to apply this logic to all sheets in a workbook, for a
specific range (say A1-Z100) .... OR even better would be to apply to
the 'used' range on each sheet (since it will vary).


TIA, Ray


Sub Macro2()
Dim cell as Range
for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub


Thanks Susan ... worked perfectly!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Insert Value based on ColorIndex, for specific range on all sheets

yipee!! i got one right!
:)
susan

On Mar 20, 9:20 am, "Ray" wrote:
On Mar 20, 8:24 am, "Susan" wrote:





additions don't have


Sub Macro2()
Dim cell as Range


MsgBox ActiveSheet.UsedRange.Address
'you could also try
'MsgBox ActiveSheet.CurrentRegion.Address
'this is just for testing purposes
'to make sure you have the right range.
'& can be deleted once macro
'is working properly
ActiveSheet.UsedRange.Select


for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub


i didn't test this but it should work.
:)
susan


On Mar 20, 7:18 am, "Ray" wrote:


Hello -


Searching through some old posts, I found this code to use
Interior.ColorIndex to assign a value to a cell. I need to modify
this code to apply this logic to all sheets in a workbook, for a
specific range (say A1-Z100) .... OR even better would be to apply to
the 'used' range on each sheet (since it will vary).


TIA, Ray


Sub Macro2()
Dim cell as Range
for each cell in selection
Select Case cell.Interior.ColorIndex
Case 46 'Color from 6th row 6th over
cell.Value = "Severe"
Case 20 'Green
cell.Value = "Slight"
Case 26 'Yellow
cell.Value = "Minor"
End Select
Next Cell
End Sub


Thanks Susan ... worked perfectly!- Hide quoted text -

- Show quoted text -



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 value based on range GL Excel Worksheet Functions 3 October 29th 08 09:04 PM
Insert rows based on specific value bob Excel Worksheet Functions 6 February 29th 08 07:11 PM
display a range of editible cells based on specific in another cel Miki Excel Discussion (Misc queries) 0 October 10th 07 04:17 PM
Insert Formatted Row at specific point within Dynamic Range ksp Excel Programming 4 June 8th 06 03:44 AM
creating new sheets based on specific data dfeld71 Excel Programming 1 June 9th 05 07:33 PM


All times are GMT +1. The time now is 10:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"