Hello I have this macro and it works fine, except... The only issue I am having is my data is not consistent. In column "O" some of the rows have the client name and some don't. I need to update my macro so that when it runs all rows in column "O" are completed with the client name. The value is the same for every row in Column "O" except for the header.
Is there a way I can pull the value from "O" and assign it to all rows in the column?
Also there is a macro to identify which is the last row in the sheet, please help.
Sub Awesome()
Dim Ret
Dim Lastrow As Long
Set AC = ActiveWorkbook.ActiveSheet
Ret = Application.GetOpenFilename("Text Files (*.txt), *.txt")
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
If Ret <> False Then
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & Ret, Destination:=Range("$A$2"))
.Name = "*.txt"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = "|"
.TextFileColumnDataTypes = Array(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, _
2, 2, 2, 2, 2, 2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
Cells.Select
Selection.ColumnWidth = 9.14
End With
End If
Call Merged 'Merged Macro
Call Sort 'Sorting Macro
Worksheets("AC").Range("O2:O" & Lastrow).Value = ??????? 'Adds Client Name to all rows
End Sub
Is there a way I can pull the value from "O" and assign it to all rows in the column?
Also there is a macro to identify which is the last row in the sheet, please help.
Sub Awesome()
Dim Ret
Dim Lastrow As Long
Set AC = ActiveWorkbook.ActiveSheet
Ret = Application.GetOpenFilename("Text Files (*.txt), *.txt")
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
If Ret <> False Then
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & Ret, Destination:=Range("$A$2"))
.Name = "*.txt"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = "|"
.TextFileColumnDataTypes = Array(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, _
2, 2, 2, 2, 2, 2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
Cells.Select
Selection.ColumnWidth = 9.14
End With
End If
Call Merged 'Merged Macro
Call Sort 'Sorting Macro
Worksheets("AC").Range("O2:O" & Lastrow).Value = ??????? 'Adds Client Name to all rows
End Sub