Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50186

inserting text under the last used cell in a column

$
0
0
Hi,

I have developed a tool which will format a report pulled from one of my firm sites. i need to insert text under the last used cell. i know it works using offset but i am not that much familiar with coding.
the reason is the reports will be on diff size and the last used cell in a column will vary from report to report.
please help.

The code i use is as below:

Sub TrackerInitiatePre()
'
' TrackerInitiatePre Macro
'
' Keyboard Shortcut: Ctrl+Shift+I
'
Application.ScreenUpdating = False

FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to import", _
FileFilter:="All Files ,")
''
If FileToOpen = False Then
MsgBox "Lol...!! You Didn't Specify Any File.", vbExclamation, "Duh!!!"
Exit Sub
Else
Workbooks.Open Filename:=FileToOpen
End If


Cells.Select
Selection.RowHeight = 22
With Selection
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
With Selection.Font
.Name = "Calibri"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Cells.EntireColumn.AutoFit
Rows("1:1").Select
With Selection.Font
.Name = "Calibri"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
Rows("3:3").Select
ActiveWindow.FreezePanes = True
Range("D2").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
Dim S As Integer
Dim X As Integer

X = Sheets.Count


For S = 1 To X

NewName = Range("A4").Value
ActiveSheet.Name = NewName

Next
End With

Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.FormulaR1C1 = "Notes:"
Range("A2").Select
ActiveCell.FormulaR1C1 = "1. Please update the Last Extension filed dates,WBS along with the corresponding dates which you would need to be reflected in tracker."
Range("A3").Select
ActiveCell.FormulaR1C1 = "2. Do let us know of any further updates and highlight them so that we get it reflected in tracker."
With Range("F:F")
.Columns.Hidden = Not .Columns.Hidden
End With
With Range("Q:AL")
.Columns.Hidden = Not .Columns.Hidden
End With
With Range("N:N")
.Columns.Hidden = Not .Columns.Hidden
End With
With Range("H:J")
.Columns.Hidden = Not .Columns.Hidden
End With
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub


Please advise.

Viewing all articles
Browse latest Browse all 50186

Trending Articles