0

I have a code, which basically makes one formula for B10, then it copies it all the way down and insert it back as values to remove the formula and make it more 'clean'.

My issue is that I have a defined 'lastrow' which in this case is 5000. Can I somehow introduce a lastrow which enables it code to copy it down until there is no data in the row. (if a specific column is to be used, then Column C can be used for this.

can this be solved?

Sheets("Table").Range("B10").Formula = "=LEFT(F10,4)&E10&D10&C10"
Sheets("Table").Range("B10").Copy
Sheets("Table").Range("B11:B5000").PasteSpecial xlPasteAll
Sheets("Table").Range("B10:B5000").Copy
Sheets("Table").Range("B10:B5000").PasteSpecial xlPasteValues
Community
  • 1
  • 1
Aabo
  • 191
  • 1
  • 6
  • 15
  • Yes first find the lastrow with data in that column like `lastrow = sheet1.Range("A" & rows.count).end(xlup).row` will return the last row with the data then use range.Autofill method instead of copy and pasting and use `With` Keyword to avoid referencing the same sheet again and again. – Stupid_Intern Apr 16 '17 at 16:35
  • HI new guy, I understand your logic. But how will this look as a VBA code? Can it for instance be built into the code above? (Sorry this is new to me, and im learning new things each day :) – Aabo Apr 16 '17 at 17:36

0 Answers0