Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Insert New Row with auto formatting.

I have a formula here that automatically inserst a new row and formats the
text in it bold.
I would like this newly inserted row to automatically be formatted to have
the cells AC:AF formatted with a thin line boarder and fill color Aqua. Can
anyone help with the code please
Thank you in advance

Sub NewRow()

EndRow = Cells(Rows.Count, 1).End(xlUp).Row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "TotalHours"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
Union(Cells(n, "AF"), Cells(n, "AC")).Font.Bold = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Insert New Row with auto formatting.

hi
add this at the end of your code for the color and line. i am not sure what
your definition of "Aqua" is so i guessed.
Union(Cells(n, "AF"), Cells(n, "AC")).Interior.ColorIndex = 28
Union(Cells(n, "AF"), Cells(n, "AC")).Borders.LineStyle = xlContinuous
Union(Cells(n, "AF"), Cells(n, "AC")).Borders.Weight = xlThin

see this site for other colors.
http://www.mvps.org/dmcritchie/excel/colors.htm

regards
FSt1

"aussiegirlone" wrote:

I have a formula here that automatically inserst a new row and formats the
text in it bold.
I would like this newly inserted row to automatically be formatted to have
the cells AC:AF formatted with a thin line boarder and fill color Aqua. Can
anyone help with the code please
Thank you in advance

Sub NewRow()

EndRow = Cells(Rows.Count, 1).End(xlUp).Row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "TotalHours"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
Union(Cells(n, "AF"), Cells(n, "AC")).Font.Bold = True
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Insert New Row with auto formatting.

The colorIndex was 42 and yes this works beautiful. Thank you

"FSt1" wrote:

hi
add this at the end of your code for the color and line. i am not sure what
your definition of "Aqua" is so i guessed.
Union(Cells(n, "AF"), Cells(n, "AC")).Interior.ColorIndex = 28
Union(Cells(n, "AF"), Cells(n, "AC")).Borders.LineStyle = xlContinuous
Union(Cells(n, "AF"), Cells(n, "AC")).Borders.Weight = xlThin

see this site for other colors.
http://www.mvps.org/dmcritchie/excel/colors.htm

regards
FSt1

"aussiegirlone" wrote:

I have a formula here that automatically inserst a new row and formats the
text in it bold.
I would like this newly inserted row to automatically be formatted to have
the cells AC:AF formatted with a thin line boarder and fill color Aqua. Can
anyone help with the code please
Thank you in advance

Sub NewRow()

EndRow = Cells(Rows.Count, 1).End(xlUp).Row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "TotalHours"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
Union(Cells(n, "AF"), Cells(n, "AC")).Font.Bold = True
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Insert New Row with auto formatting.

glad to help

regards
FSt1

"aussiegirlone" wrote:

The colorIndex was 42 and yes this works beautiful. Thank you

"FSt1" wrote:

hi
add this at the end of your code for the color and line. i am not sure what
your definition of "Aqua" is so i guessed.
Union(Cells(n, "AF"), Cells(n, "AC")).Interior.ColorIndex = 28
Union(Cells(n, "AF"), Cells(n, "AC")).Borders.LineStyle = xlContinuous
Union(Cells(n, "AF"), Cells(n, "AC")).Borders.Weight = xlThin

see this site for other colors.
http://www.mvps.org/dmcritchie/excel/colors.htm

regards
FSt1

"aussiegirlone" wrote:

I have a formula here that automatically inserst a new row and formats the
text in it bold.
I would like this newly inserted row to automatically be formatted to have
the cells AC:AF formatted with a thin line boarder and fill color Aqua. Can
anyone help with the code please
Thank you in advance

Sub NewRow()

EndRow = Cells(Rows.Count, 1).End(xlUp).Row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "TotalHours"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
Union(Cells(n, "AF"), Cells(n, "AC")).Font.Bold = True
End Sub

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
Auto Insert NEw Row with formatting Greg Excel Discussion (Misc queries) 2 June 24th 09 01:50 PM
Need VBA script to auto-insert value upon row insert Phil Excel Worksheet Functions 4 May 6th 08 02:41 PM
auto insert jason2444 Excel Discussion (Misc queries) 2 January 3rd 07 07:36 PM
Can I auto insert a worksheet when I insert a value in a cell. iainc Excel Worksheet Functions 0 April 27th 06 08:37 AM
Auto Insert/Auto Formula? Abacus Excel Worksheet Functions 1 February 3rd 06 11:33 AM


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