Hopefully I can articulate this....I have a Workbook which I cannot post a lot of the code to because it is proprietary but basically I have prompted the user to load 3 files that data will be retrieved and used from. I have assigned Name Ranges to "Grids" "Elements" and "TEMP" in this code. The workbook has found, copied, and pasted data from one sheet to another. (I'll post specific code below this for clarification) In this new sheet I have moved over one cell to the right to start a new column next to it since the data is still selected from the paste. This new column was given a title and I know need to apply a formula to the first cell and copy it down the length of original data (so I have 2 equal columns).
'Avg Temp Column
'Select C2 to input name "AVG TEMP"
ActiveCell.Offset(0, 1).Activate 'Moving from the Active Column to the Cell next to it
ActiveCell = "AVG TEMP" 'Named this Column
'Select cell below for finding Average Temp for Element ID
ActiveCell.Offset(1, 0).Activate 'Moved to cell below the newly named column
ActiveCell.FormulaR1C1 = "=Application.WorksheetFunction.Average(Application.WorksheetFunction.VLookup(Application.WorksheetFunction.Index(""Grids"", Application.WorksheetFunction.Match(ActiveCell.Offset(1, 0), ""Elements"", 0), 1), ""TEMP"", 2, False)"
Selection.AutoFill Destination:=Range(?)
Essentially I'm stuck on the Range since I won't know in advance how long the column is. Is there a way basically tell the code to copy the formula down until there is a blank cell and to just stop?
Thank you!
Bookmarks