M Mike Jan 12, 2004 #1 I have two variables (type long): first and last. How do I select the rows first..last and delete them? Thanks.
I have two variables (type long): first and last. How do I select the rows first..last and delete them? Thanks.
R Ron de Bruin Jan 12, 2004 #2 Try this Sub test() Dim first As Long Dim last As Long first = 12 last = 15 Rows(first & ":" & last).Delete End Sub
Try this Sub test() Dim first As Long Dim last As Long first = 12 last = 15 Rows(first & ":" & last).Delete End Sub
J John Wilson Jan 12, 2004 #3 Mike, Dim lRow as long lRow = 2 Range("A" & lRow).EntireRow.Delete Can do the same for the first row. Delete the last one first, and the then the first one (just to be safe). John
Mike, Dim lRow as long lRow = 2 Range("A" & lRow).EntireRow.Delete Can do the same for the first row. Delete the last one first, and the then the first one (just to be safe). John
D Dennis Jan 12, 2004 #4 What is the significance of "Variables (Long type)" in VBA? Are some examples that reflect that significance possible? Thanks!
What is the significance of "Variables (Long type)" in VBA? Are some examples that reflect that significance possible? Thanks!
R Ron de Bruin Jan 12, 2004 #5 Hi Dennis We have more then 32767 rows in Excel so a if you dim as integer the below example will give you a error because 32767 is the limit for a integer Dim first As Integer Dim last As Integer first = 12 last = 32768 Rows(first & ":" & last).Delete highlight the word long or integer in the code and press F1 The VBA help will tell you all about it
Hi Dennis We have more then 32767 rows in Excel so a if you dim as integer the below example will give you a error because 32767 is the limit for a integer Dim first As Integer Dim last As Integer first = 12 last = 32768 Rows(first & ":" & last).Delete highlight the word long or integer in the code and press F1 The VBA help will tell you all about it