I've got a macro where I'm trying to do the following:
- Format the information in the "CleanData" tab
- Copy the data into the "Raw Data" tab at the bottom of the current data set
- Input a value into the "Week" and "Year" column of the "Raw Data" tab and then copy those values to the bottom of the data set that I just copied down
the following VBA code is what I have so far:
Sub FormatData()
'
' FormatData Macro
'
'
Sheets("CleanData").Select
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="(", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Columns("B:B").Select
Selection.Replace What:=")", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("A1:S35").Select
Selection.Copy
Sheets("Raw Data").Select
Range("C4").Select
Selection.End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Range("B4").Select
Selection.End(xlDown).Offset(1, 0).Select
Value1 = InputBox(prompt:="Week #")
ActiveCell.FormulaR1C1 = Value1
Selection.Offset(0, -1).Select
Value1 = InputBox(prompt:="Year")
ActiveCell.FormulaR1C1 = Value1
Range(ActiveCell, ActiveCell.Offset(0, 1)).Select
Selection.AutoFill Range(ActiveCell.Address, Cells(LastRow, ActiveCell.Column))
End Sub
The issue I'm having is once I get to the "Selection.AutoFill Range(ActiveCell.Address..." - I can't find a way to select the two cells I've just input data for and then autofill the data in those cells to the bottom of the current data set. Note that I'd like to be able to do this several times so the data set will continue to grow and grow. Any help is appreciated - thanks in advance!!
Bookmarks