0

I would like to conduct the following: 1. Find the last column with data from cell A4 until end 2. Back calculate last column by - 6 columns 3. Select the entire range of columns from -6 to last column (last code listed below does not work)

lastcol = Cells(4, Columns.Count).End(xlToLeft).Column
fircol = lastcol - 6
Columns(fircol & ":" & lastcol).Select
Evan Goh
  • 43
  • 1
  • 7
  • 1
    In the last line, change `Columns` to `Range`... but note that [you probably shouldn't `Select`](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba) to begin with. – BigBen Apr 27 '20 at 02:41
  • @BigBen , i tried that & the macro ended up selecting rows 200++ instead which i am unsure why – Evan Goh Apr 27 '20 at 02:43
  • 2
    Oh sorry... yeah I'm thinking of `Rows`, not `Columns`... Use `Columns(fircol).Resize(,6)`. – BigBen Apr 27 '20 at 02:45
  • that worked.Awesome ! thanks a lot – Evan Goh Apr 27 '20 at 02:56

0 Answers0