Hi all,
I've got a couple problems working with ranges in VBA. I have a set of values in a table, and I want to clear a row each time I run my macro. This was fine when I had a set range (Sheets("Calculator").Range("F23:F46").Value = "") but now I have some code which inserts and deletes rows from my table.
So now, my range could be F23:F30, and then with a new row added it goes from F23:F31. Or, on the flip side it could decrease to F23:F29.
I have code which tells me how many values are in the list, so I know where the first row always is (F23) and I know where the last row is (Row 23 + TotalCount-1) But I don't know how to turn that into a lettered range. I can't exactly say "F23:F23+TotalCount-1"
So that's problem 1 with ranges.
Problem 2 comes from adding a new row. My table has automatically calculated cells in Column E, G and I. I usually use autofill to copy the cells down. Works fine when doing it manually. As I understand it, to do this automatically, I'd need to reference a Range.
Eg, Selection.AutoFill Destination:=Range(E29:E30). Same problem as above, I can't select the last row, expand that by 1, and use the Range for Auto fill.
Anybody know what I can do to acheive my goals?
Thanks in advance,
-Bob
Bookmarks