#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 144
Default code

Hi all,

In rows 2 to and with 252 of my worksheet cells in colums AK up to and
including AR contain dates or blanks. In row 1 the cells in colums AK to and
with AR ("header cells") have different interior colors, their text is bold
and black except for AO1 and AR1 where the text is bold and white.

I want the first cell of a row to have the same interior color and text
color of the header cell corresponding with the highest date (I mean: date
most in the future) in that row in colums AK to AR.

What code do I need?

Thanks in advance for your assistance.

Jack Sons
The Netherlands


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default code

Jack Sons,

If by "the first cell of a row" you mean column A:

Sub TryNow()
Dim myR As Long
Dim myC As Integer

For myR = 2 To Cells(Rows.Count, Range("AK1").Column).End(xlUp).Row
myC = Application.Match(Application.Max(Cells(myR, Range("AK1").Column) _
.Resize(1, 8)), Cells(myR, 1).EntireRow, False)
Cells(myR, 1).EntireRow.Cells(1, myC).Copy
Cells(myR, 1).PasteSpecial xlPasteFormats
Next myR
End Sub



--
HTH,
Bernie
MS Excel MVP


"Jack Sons" wrote in message ...
Hi all,

In rows 2 to and with 252 of my worksheet cells in colums AK up to and including AR contain dates
or blanks. In row 1 the cells in colums AK to and with AR ("header cells") have different interior
colors, their text is bold and black except for AO1 and AR1 where the text is bold and white.

I want the first cell of a row to have the same interior color and text color of the header cell
corresponding with the highest date (I mean: date most in the future) in that row in colums AK to
AR.

What code do I need?

Thanks in advance for your assistance.

Jack Sons
The Netherlands



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 144
Default code

Bernie,

Thanks for your help. When I execute the code I see it stepping through
column A from row 2 downwards, but it doesn't change anything.

What could be wrong?

Jack.


"Bernie Deitrick" <deitbe @ consumer dot org schreef in bericht
...
Jack Sons,

If by "the first cell of a row" you mean column A:

Sub TryNow()
Dim myR As Long
Dim myC As Integer

For myR = 2 To Cells(Rows.Count, Range("AK1").Column).End(xlUp).Row
myC = Application.Match(Application.Max(Cells(myR, Range("AK1").Column) _
.Resize(1, 8)), Cells(myR, 1).EntireRow, False)
Cells(myR, 1).EntireRow.Cells(1, myC).Copy
Cells(myR, 1).PasteSpecial xlPasteFormats
Next myR
End Sub



--
HTH,
Bernie
MS Excel MVP


"Jack Sons" wrote in message
...
Hi all,

In rows 2 to and with 252 of my worksheet cells in colums AK up to and
including AR contain dates or blanks. In row 1 the cells in colums AK to
and with AR ("header cells") have different interior colors, their text
is bold and black except for AO1 and AR1 where the text is bold and
white.

I want the first cell of a row to have the same interior color and text
color of the header cell corresponding with the highest date (I mean:
date most in the future) in that row in colums AK to AR.

What code do I need?

Thanks in advance for your assistance.

Jack Sons
The Netherlands





  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 144
Default code

Bernie,

I'm afraid I whined too early because with a little more thinking I made the
code work with the following change. Is it correct?

'Cells(myR, 1).EntireRow.Cells(1, myC).Copy
Cells(1, myC).Copy

Jack.



"Bernie Deitrick" <deitbe @ consumer dot org schreef in bericht
...
Jack Sons,

If by "the first cell of a row" you mean column A:

Sub TryNow()
Dim myR As Long
Dim myC As Integer

For myR = 2 To Cells(Rows.Count, Range("AK1").Column).End(xlUp).Row
myC = Application.Match(Application.Max(Cells(myR, Range("AK1").Column) _
.Resize(1, 8)), Cells(myR, 1).EntireRow, False)
Cells(myR, 1).EntireRow.Cells(1, myC).Copy
Cells(myR, 1).PasteSpecial xlPasteFormats
Next myR
End Sub



--
HTH,
Bernie
MS Excel MVP


"Jack Sons" wrote in message
...
Hi all,

In rows 2 to and with 252 of my worksheet cells in colums AK up to and
including AR contain dates or blanks. In row 1 the cells in colums AK to
and with AR ("header cells") have different interior colors, their text
is bold and black except for AO1 and AR1 where the text is bold and
white.

I want the first cell of a row to have the same interior color and text
color of the header cell corresponding with the highest date (I mean:
date most in the future) in that row in colums AK to AR.

What code do I need?

Thanks in advance for your assistance.

Jack Sons
The Netherlands





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default code

Jack,

It's hard to say if the code is correct or not because I am not exactly sure
what it is that you are doing.

The true test is whether your results are what you expect or not. If you're
getting the result you want, the code is probably good.

Bernie


"Jack Sons" wrote in message
...
Bernie,

I'm afraid I whined too early because with a little more thinking I made
the code work with the following change. Is it correct?

'Cells(myR, 1).EntireRow.Cells(1, myC).Copy
Cells(1, myC).Copy

Jack.



"Bernie Deitrick" <deitbe @ consumer dot org schreef in bericht
...
Jack Sons,

If by "the first cell of a row" you mean column A:

Sub TryNow()
Dim myR As Long
Dim myC As Integer

For myR = 2 To Cells(Rows.Count, Range("AK1").Column).End(xlUp).Row
myC = Application.Match(Application.Max(Cells(myR, Range("AK1").Column)
_
.Resize(1, 8)), Cells(myR, 1).EntireRow, False)
Cells(myR, 1).EntireRow.Cells(1, myC).Copy
Cells(myR, 1).PasteSpecial xlPasteFormats
Next myR
End Sub



--
HTH,
Bernie
MS Excel MVP


"Jack Sons" wrote in message
...
Hi all,

In rows 2 to and with 252 of my worksheet cells in colums AK up to and
including AR contain dates or blanks. In row 1 the cells in colums AK to
and with AR ("header cells") have different interior colors, their text
is bold and black except for AO1 and AR1 where the text is bold and
white.

I want the first cell of a row to have the same interior color and text
color of the header cell corresponding with the highest date (I mean:
date most in the future) in that row in colums AK to AR.

What code do I need?

Thanks in advance for your assistance.

Jack Sons
The Netherlands








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
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Unprotect Code Module in Code Damien Excel Discussion (Misc queries) 2 April 18th 06 03:10 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM


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