Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Append a column with the text "Remarks"

Hi,

We recorded a macro below to automatically filter, align horizontally,
center vertically and orient 90 deg. and so on of the headings for a
certain workbook. How can I add a program in the same macro that will
automatically append a column with the text "Remarks" which has the
same alignment and font settings as the other headings?

Sorry for having a spoonfeeding attitude but I tried several times to
no avail. I am still a newbie.

Your support is highly appreciated.



ActiveWindow.Zoom = 80
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
Selection.AutoFilter
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Range("A1").Select
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Append a column with the text "Remarks"

Hi,
Hopefully the following will help.

I have assigned the headings to an array called Headings. As arrays start
with an index of 0, the "NotUsed" is not used! so ignore. I assume the
headings go in row 1 so in my example A1 will contain "Column A" and B1 will
contain "Remarks". Change the text "Column A" to your heading.


If you want to add more columns, add values to the Headings array and change
to the "For c=1 to 2" to For c=1 to n" where n is the number of
columns(/Headings).

HTH

Dim c As Integer
Headings = Array(" NotUsed", "Column A ", "Remarks")

ActiveWindow.Zoom = 80

For c = 1 To 2

Cells(1, c) = Headings(c) ' assign heading to row 1, column c
Rows(c & ":" & c).Select ' select column
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.VerticalAlignment = xlCenter
.Orientation = 90
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
End With
Cells.Select
Cells.EntireColumn.AutoFit

Next c

Range("A1").Select
Selection.AutoFilter
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Range("A1").Select

End Sub



" wrote:

Hi,

We recorded a macro below to automatically filter, align horizontally,
center vertically and orient 90 deg. and so on of the headings for a
certain workbook. How can I add a program in the same macro that will
automatically append a column with the text "Remarks" which has the
same alignment and font settings as the other headings?

Sorry for having a spoonfeeding attitude but I tried several times to
no avail. I am still a newbie.

Your support is highly appreciated.



ActiveWindow.Zoom = 80
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
Selection.AutoFilter
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Range("A1").Select
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Append a column with the text "Remarks"

Your formatting the whole first row, so the formatting should already be the
same

ActiveWindow.Zoom = 80
' added line
Cells(1,256).End(xltoLeft)(1,2).Value = "Remarks"
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
Selection.AutoFilter
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Range("A1").Select
End Sub

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
Hi,

We recorded a macro below to automatically filter, align horizontally,
center vertically and orient 90 deg. and so on of the headings for a
certain workbook. How can I add a program in the same macro that will
automatically append a column with the text "Remarks" which has the
same alignment and font settings as the other headings?

Sorry for having a spoonfeeding attitude but I tried several times to
no avail. I am still a newbie.

Your support is highly appreciated.



ActiveWindow.Zoom = 80
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 90
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
Selection.AutoFilter
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Range("A1").Select
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
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM
How do I split "A1B2" into "A1" and "B2" using text to column fun. Jennifer Excel Programming 1 February 2nd 05 10:01 PM


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