Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 45
Default Format Fill Down to Last Row

I know it is possible for formulas, etc, but is it possible to have a macro
that formats a column of cells and only formats down to the last row? It
will always be the same column, but there will be a different number of rows
each time.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,942
Default Format Fill Down to Last Row

hi,
yes it is possible.
What row?
what format?

regards
FSt1

"Keep It Simple Stupid" wrote:

I know it is possible for formulas, etc, but is it possible to have a macro
that formats a column of cells and only formats down to the last row? It
will always be the same column, but there will be a different number of rows
each time.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,942
Default Format Fill Down to Last Row

hi
excuse....what column?

regards
FSt1

"FSt1" wrote:

hi,
yes it is possible.
What row?
what format?

regards
FSt1

"Keep It Simple Stupid" wrote:

I know it is possible for formulas, etc, but is it possible to have a macro
that formats a column of cells and only formats down to the last row? It
will always be the same column, but there will be a different number of rows
each time.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 45
Default Format Fill Down to Last Row

Format: The diagonal line going through the cell (lower left to upper right)
Row: The last row that is populated (remember, this will change everytime I
run the macro)
Column: D

In other words:
Selection.Borders(xlDiagonalDown).Linestyle=xlNone
With selection.borders(xlDiagonalup)
.Linestyle=xlContinuous
.Weight=xlHairline
..ColorIndex=xlAutomatic
....

"FSt1" wrote:

hi,
yes it is possible.
What row?
what format?

regards
FSt1

"Keep It Simple Stupid" wrote:

I know it is possible for formulas, etc, but is it possible to have a macro
that formats a column of cells and only formats down to the last row? It
will always be the same column, but there will be a different number of rows
each time.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,942
Default Format Fill Down to Last Row

hi
this should work. try it and post back if problems.
sub addformats()
Dim r As Long
lr = cells(Rows.Count, "D").End(xlUp).Row
Range("D1:D" & lr).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Regards
FSt1

"Keep It Simple Stupid" wrote:

Format: The diagonal line going through the cell (lower left to upper right)
Row: The last row that is populated (remember, this will change everytime I
run the macro)
Column: D

In other words:
Selection.Borders(xlDiagonalDown).Linestyle=xlNone
With selection.borders(xlDiagonalup)
.Linestyle=xlContinuous
.Weight=xlHairline
.ColorIndex=xlAutomatic
...

"FSt1" wrote:

hi,
yes it is possible.
What row?
what format?

regards
FSt1

"Keep It Simple Stupid" wrote:

I know it is possible for formulas, etc, but is it possible to have a macro
that formats a column of cells and only formats down to the last row? It
will always be the same column, but there will be a different number of rows
each time.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Format Fill Down to Last Row

Sub Auto_Format()
Dim Lrow As Long
With ActiveSheet
Columns(3).Cells.Interior.ColorIndex = xlNone
Lrow = Range("C" & Rows.Count).End(xlUp).Row
Range("C1:C" & Lrow).Interior.ColorIndex = 3
End With
End Sub


Gord Dibben MS Excel MVP

On Mon, 12 Nov 2007 07:18:02 -0800, Keep It Simple Stupid
wrote:

I know it is possible for formulas, etc, but is it possible to have a macro
that formats a column of cells and only formats down to the last row? It
will always be the same column, but there will be a different number of rows
each time.


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Format Fill Down to Last Row

I would add one line to clear the borders from the previous range.

Otherwise they will remain if number of rows is less than previous.

Sub addformats()
Dim r As Long
lr = Cells(Rows.Count, "D").End(xlUp).Row
Columns("D").Borders(xlDiagonalUp).LineStyle = xlNone 'add this line
Range("D1:D" & lr).Select
'this line not needed Selection.Borders(xlDiagonalDown).LineStyle = xlNone
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub


Gord

On Mon, 12 Nov 2007 08:20:05 -0800, FSt1 wrote:

hi
this should work. try it and post back if problems.
sub addformats()
Dim r As Long
lr = cells(Rows.Count, "D").End(xlUp).Row
Range("D1:D" & lr).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Regards
FSt1

"Keep It Simple Stupid" wrote:

Format: The diagonal line going through the cell (lower left to upper right)
Row: The last row that is populated (remember, this will change everytime I
run the macro)
Column: D

In other words:
Selection.Borders(xlDiagonalDown).Linestyle=xlNone
With selection.borders(xlDiagonalup)
.Linestyle=xlContinuous
.Weight=xlHairline
.ColorIndex=xlAutomatic
...

"FSt1" wrote:

hi,
yes it is possible.
What row?
what format?

regards
FSt1

"Keep It Simple Stupid" wrote:

I know it is possible for formulas, etc, but is it possible to have a macro
that formats a column of cells and only formats down to the last row? It
will always be the same column, but there will be a different number of rows
each time.


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
Can search by cell format like fill color? T-Diego Excel Worksheet Functions 1 April 29th 06 12:23 AM
Can't format font colors or cell fill-in colors canoeron Excel Discussion (Misc queries) 3 August 22nd 05 11:46 PM
How do you format a sheet to fill the entire page to print? Lindsay Excel Discussion (Misc queries) 1 June 28th 05 09:17 PM
How do I format a picture fill in my pie chart? contextman Charts and Charting in Excel 0 June 10th 05 04:57 PM
Can I format a cell to fill red when clicked with mouse (Excel)? mike.wilson Excel Worksheet Functions 4 May 2nd 05 08:01 AM


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