Endorphin
12-15-2008, 05:23 PM
Hi All !!!!!
OK, I have a Macro which imports data, and then adds a filtered version of that data to sheet B in columns A to E, this will happen on a weekly basis, is there a way to add predefined formulas to Columns F,G,H,I,J?? when the new data is added to the sheet?
Below is the code used to add the new data.
Sub Move()
newrow = Sheets("Stored Data").Cells(60000, 1).End(xlUp).Row + 1
lastrow = Sheets("Temp").Cells(60000, 1).End(xlUp).Row
firstrow = Sheets("Temp").Cells(lastrow, 1).End(xlUp).Row
colA = Sheets("Temp").Cells(firstrow, 1)
For i = 2 To newrow - 1
If Sheets("Stored Data").Cells(i, 1) = colA Then MsgBox ("This Data has already been imported. Muppet!!")
If Sheets("Stored Data").Cells(i, 1) = colA Then GoTo done
Next i
Sheets("Temp").Range(Cells(firstrow, 1), Cells(lastrow, 5)).Copy _
Sheets("Stored Data").Cells(newrow, 1)
done:
End Sub
OK, I have a Macro which imports data, and then adds a filtered version of that data to sheet B in columns A to E, this will happen on a weekly basis, is there a way to add predefined formulas to Columns F,G,H,I,J?? when the new data is added to the sheet?
Below is the code used to add the new data.
Sub Move()
newrow = Sheets("Stored Data").Cells(60000, 1).End(xlUp).Row + 1
lastrow = Sheets("Temp").Cells(60000, 1).End(xlUp).Row
firstrow = Sheets("Temp").Cells(lastrow, 1).End(xlUp).Row
colA = Sheets("Temp").Cells(firstrow, 1)
For i = 2 To newrow - 1
If Sheets("Stored Data").Cells(i, 1) = colA Then MsgBox ("This Data has already been imported. Muppet!!")
If Sheets("Stored Data").Cells(i, 1) = colA Then GoTo done
Next i
Sheets("Temp").Range(Cells(firstrow, 1), Cells(lastrow, 5)).Copy _
Sheets("Stored Data").Cells(newrow, 1)
done:
End Sub