Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Changing the text color of a complete row ...

Looking for a solution please ... Before a workbook is saved, I would
like excel to check the contents of cells in column A and if the cell
is not empty then I would like excel to change the text color for the
complete row to a different color (automatic to red for example).

Can anyone offer a solution to this please?

Many thanks for you help.

Rob.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changing the text color of a complete row ...

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim i As Long
With Worksheets("Sheet1")
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, "A").Value < "" Then
.Rows(i).Interior.ColorIndex = 3
End If
Next i
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"Rob Keel" wrote in message
oups.com...
Looking for a solution please ... Before a workbook is saved, I would
like excel to check the contents of cells in column A and if the cell
is not empty then I would like excel to change the text color for the
complete row to a different color (automatic to red for example).

Can anyone offer a solution to this please?

Many thanks for you help.

Rob.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Changing the text color of a complete row ...

Excellent. Thank you very much for that Bob.

One more question though if you don't mind ... How would I amend this
code to not include column headers i.e. the labels in row 1 of the
sheet?

Thanks.

Rob.


Bob Phillips wrote:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim i As Long
With Worksheets("Sheet1")
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, "A").Value < "" Then
.Rows(i).Interior.ColorIndex = 3
End If
Next i
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"Rob Keel" wrote in message
oups.com...
Looking for a solution please ... Before a workbook is saved, I would
like excel to check the contents of cells in column A and if the cell
is not empty then I would like excel to change the text color for the
complete row to a different color (automatic to red for example).

Can anyone offer a solution to this please?

Many thanks for you help.

Rob.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changing the text color of a complete row ...

Start the loop at 2 instead of 1.

--
HTH

Bob Phillips

"Rob Keel" wrote in message
ups.com...
Excellent. Thank you very much for that Bob.

One more question though if you don't mind ... How would I amend this
code to not include column headers i.e. the labels in row 1 of the
sheet?

Thanks.

Rob.


Bob Phillips wrote:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim i As Long
With Worksheets("Sheet1")
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, "A").Value < "" Then
.Rows(i).Interior.ColorIndex = 3
End If
Next i
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"Rob Keel" wrote in message
oups.com...
Looking for a solution please ... Before a workbook is saved, I would
like excel to check the contents of cells in column A and if the cell
is not empty then I would like excel to change the text color for the
complete row to a different color (automatic to red for example).

Can anyone offer a solution to this please?

Many thanks for you help.

Rob.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Changing the text color of a complete row ...

Cheers Bob.

Sorry, I only recently started coding so a bit of a beginner at
present.

Once again, many thanks.

Rob.


Bob Phillips wrote:
Start the loop at 2 instead of 1.

--
HTH

Bob Phillips

"Rob Keel" wrote in message
ups.com...
Excellent. Thank you very much for that Bob.

One more question though if you don't mind ... How would I amend this
code to not include column headers i.e. the labels in row 1 of the
sheet?

Thanks.

Rob.


Bob Phillips wrote:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim i As Long
With Worksheets("Sheet1")
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, "A").Value < "" Then
.Rows(i).Interior.ColorIndex = 3
End If
Next i
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"Rob Keel" wrote in message
oups.com...
Looking for a solution please ... Before a workbook is saved, I would
like excel to check the contents of cells in column A and if the cell
is not empty then I would like excel to change the text color for the
complete row to a different color (automatic to red for example).

Can anyone offer a solution to this please?

Many thanks for you help.

Rob.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Changing the text color of a complete row ...

No problem, it is only obvious when you know it <vbg

regards

Bob

"Rob Keel" wrote in message
oups.com...
Cheers Bob.

Sorry, I only recently started coding so a bit of a beginner at
present.

Once again, many thanks.

Rob.


Bob Phillips wrote:
Start the loop at 2 instead of 1.

--
HTH

Bob Phillips

"Rob Keel" wrote in message
ups.com...
Excellent. Thank you very much for that Bob.

One more question though if you don't mind ... How would I amend this
code to not include column headers i.e. the labels in row 1 of the
sheet?

Thanks.

Rob.


Bob Phillips wrote:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim i As Long
With Worksheets("Sheet1")
For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If .Cells(i, "A").Value < "" Then
.Rows(i).Interior.ColorIndex = 3
End If
Next i
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"Rob Keel" wrote in message
oups.com...
Looking for a solution please ... Before a workbook is saved, I

would
like excel to check the contents of cells in column A and if the

cell
is not empty then I would like excel to change the text color for

the
complete row to a different color (automatic to red for example).

Can anyone offer a solution to this please?

Many thanks for you help.

Rob.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing the text color of a complete row ...

Why not use conditional formatting?

Select row 1 and do

Format = Conditional Formatting

In the first dropdown in the dialog, change Cell Value is to Formula is

enter a formula like

=len(Trim($A$1))=0

click the format button and select your color

--
Regards,
Tom Ogilvy


"Rob Keel" wrote in message
oups.com...
Looking for a solution please ... Before a workbook is saved, I would
like excel to check the contents of cells in column A and if the cell
is not empty then I would like excel to change the text color for the
complete row to a different color (automatic to red for example).

Can anyone offer a solution to this please?

Many thanks for you help.

Rob.



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
Changing text color based upon If KenM Excel Discussion (Misc queries) 5 November 24th 08 08:56 PM
dynamically changing text color Dave Excel Worksheet Functions 4 May 31st 07 06:38 PM
Changing several cells text color lauras03 Excel Discussion (Misc queries) 1 March 12th 07 11:03 PM
Changing text color within a formula??? Cortez Excel Discussion (Misc queries) 8 November 2nd 06 02:03 PM
Changing text color Shannon Excel Programming 4 August 13th 04 08:23 PM


All times are GMT +1. The time now is 07:07 AM.

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"