Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Formatting a Blank Row

I had got some help and recived code that checked for a
blank column and if it found the column it would color it,

I tried modifying the code to find a blank cell in a row
and then format that row

Here is the Code

Set lastrow = Cells(2, Rows.Count).End(xlTopToBottom)
Set Rng = Range(Cells(2, 5), lastrow)
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

if I set the range to range("b5:B200) then every row after
the last row of data is resized, I was trying to set the
last row to find the last row with data so it would stop
there but it failed


Any Ideas

THanks

Nigel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Formatting a Blank Row

Set lastrow = Cells(Rows.Count,"B").End(xlUp).Row
Set Rng = Range(Cells(2, 5), Cells(lastrow,"B"))
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel Bennett" wrote in message
...
I had got some help and recived code that checked for a
blank column and if it found the column it would color it,

I tried modifying the code to find a blank cell in a row
and then format that row

Here is the Code

Set lastrow = Cells(2, Rows.Count).End(xlTopToBottom)
Set Rng = Range(Cells(2, 5), lastrow)
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

if I set the range to range("b5:B200) then every row after
the last row of data is resized, I was trying to set the
last row to find the last row with data so it would stop
there but it failed


Any Ideas

THanks

Nigel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Formatting a Blank Row

It doesn't like the

set lastrow line,

comes back with object required
-----Original Message-----
Set lastrow = Cells(Rows.Count,"B").End(xlUp).Row
Set Rng = Range(Cells(2, 5), Cells(lastrow,"B"))
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel Bennett" wrote in message
...
I had got some help and recived code that checked for a
blank column and if it found the column it would color

it,

I tried modifying the code to find a blank cell in a row
and then format that row

Here is the Code

Set lastrow = Cells(2, Rows.Count).End(xlTopToBottom)
Set Rng = Range(Cells(2, 5), lastrow)
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

if I set the range to range("b5:B200) then every row

after
the last row of data is resized, I was trying to set the
last row to find the last row with data so it would stop
there but it failed


Any Ideas

THanks

Nigel



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Formatting a Blank Row

Sorry, that should just be

lastrow = Cells(Rows.Count,"B").End(xlUp).Row

no Set.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel BEnnett" wrote in message
...
It doesn't like the

set lastrow line,

comes back with object required
-----Original Message-----
Set lastrow = Cells(Rows.Count,"B").End(xlUp).Row
Set Rng = Range(Cells(2, 5), Cells(lastrow,"B"))
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel Bennett" wrote in message
...
I had got some help and recived code that checked for a
blank column and if it found the column it would color

it,

I tried modifying the code to find a blank cell in a row
and then format that row

Here is the Code

Set lastrow = Cells(2, Rows.Count).End(xlTopToBottom)
Set Rng = Range(Cells(2, 5), lastrow)
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

if I set the range to range("b5:B200) then every row

after
the last row of data is resized, I was trying to set the
last row to find the last row with data so it would stop
there but it failed


Any Ideas

THanks

Nigel



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Formatting a Blank Row

OK that worked except it found all the columns with data
in and resized the rows to 1 and turned them blank


Dim lastrow As Range
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Set Rng = Range(Cells(2, 5), Cells(lastrow, "B"))
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell
-----Original Message-----
Sorry, that should just be

lastrow = Cells(Rows.Count,"B").End(xlUp).Row

no Set.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel BEnnett" wrote in message
...
It doesn't like the

set lastrow line,

comes back with object required
-----Original Message-----
Set lastrow = Cells(Rows.Count,"B").End(xlUp).Row
Set Rng = Range(Cells(2, 5), Cells(lastrow,"B"))
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

--

HTH

RP
(remove nothere from the email address if mailing

direct)


"Nigel Bennett" wrote in message
...
I had got some help and recived code that checked

for a
blank column and if it found the column it would

color
it,

I tried modifying the code to find a blank cell in a

row
and then format that row

Here is the Code

Set lastrow = Cells(2, Rows.Count).End(xlTopToBottom)
Set Rng = Range(Cells(2, 5), lastrow)
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

if I set the range to range("b5:B200) then every row

after
the last row of data is resized, I was trying to set

the
last row to find the last row with data so it would

stop
there but it failed


Any Ideas

THanks

Nigel


.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Formatting a Blank Row

That sounds like there is a '... but ...' coming?

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
...
OK that worked except it found all the columns with data
in and resized the rows to 1 and turned them blank


Dim lastrow As Range
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Set Rng = Range(Cells(2, 5), Cells(lastrow, "B"))
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell
-----Original Message-----
Sorry, that should just be

lastrow = Cells(Rows.Count,"B").End(xlUp).Row

no Set.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel BEnnett" wrote in message
...
It doesn't like the

set lastrow line,

comes back with object required
-----Original Message-----
Set lastrow = Cells(Rows.Count,"B").End(xlUp).Row
Set Rng = Range(Cells(2, 5), Cells(lastrow,"B"))
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

--

HTH

RP
(remove nothere from the email address if mailing

direct)


"Nigel Bennett" wrote in message
...
I had got some help and recived code that checked

for a
blank column and if it found the column it would

color
it,

I tried modifying the code to find a blank cell in a

row
and then format that row

Here is the Code

Set lastrow = Cells(2, Rows.Count).End(xlTopToBottom)
Set Rng = Range(Cells(2, 5), lastrow)
For Each oCell In Rng

If oCell < 0 Then
oCell.RowHeight = 12.57
Else
oCell.RowHeight = 1
oCell.EntireRow.Interior.ColorIndex = 15
End If
Next oCell

if I set the range to range("b5:B200) then every row
after
the last row of data is resized, I was trying to set

the
last row to find the last row with data so it would

stop
there but it failed


Any Ideas

THanks

Nigel


.



.



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
conditional formatting:highlight row based on blank or non-blank c Nat Maxwell Excel Worksheet Functions 3 May 14th 23 07:43 PM
Conditional Formatting - Blank or Zero Annie Excel Discussion (Misc queries) 10 January 11th 08 09:52 PM
put zero in blank cell using conditional formatting Terry Excel Worksheet Functions 5 March 22nd 07 08:38 PM
Conditional formatting - Blank kalz Excel Discussion (Misc queries) 1 October 13th 06 05:14 AM
conditional formatting:highlight row based on blank or non-blank c Nat Maxwell Excel Discussion (Misc queries) 2 November 30th 05 10:30 PM


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