Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows with variable
Im trying to select, then delete a whole lod of rows in
one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows with variable
Jim
Sub TestDeleteRows() Dim RowCounter As Long RowCounter = 10 Rows("4:" & RowCounter).EntireRow.Delete End Sub works for me Regards Trevor "Jim" wrote in message ... Im trying to select, then delete a whole lod of rows in one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows with variable
try this
count_y=20 Rows("4:" & count_y ).entirerow.delete "Jim" wrote in message ... Im trying to select, then delete a whole lod of rows in one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows with variable
Don
it's not the winning that counts, it's the taking part ;-) Regards Trevor "Don Guillett" wrote in message ... Trevor, You may have been faster but I deleted more rows. <G "Trevor Shuttleworth" wrote in message ... Jim Sub TestDeleteRows() Dim RowCounter As Long RowCounter = 10 Rows("4:" & RowCounter).EntireRow.Delete End Sub works for me Regards Trevor "Jim" wrote in message ... Im trying to select, then delete a whole lod of rows in one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows with variable
Ah, OK.
"Trevor Shuttleworth" wrote in message ... Don it's not the winning that counts, it's the taking part ;-) Regards Trevor "Don Guillett" wrote in message ... Trevor, You may have been faster but I deleted more rows. <G "Trevor Shuttleworth" wrote in message ... Jim Sub TestDeleteRows() Dim RowCounter As Long RowCounter = 10 Rows("4:" & RowCounter).EntireRow.Delete End Sub works for me Regards Trevor "Jim" wrote in message ... Im trying to select, then delete a whole lod of rows in one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows withTWO variables
I cannot get this to work for 2 variables - please advise: (goal is to
get user input, perform calculations on input and use those row numbers as rows to delete from:to) Sub RowDel() Dim UserSpace As Integer Do Until UserNum < "" UserNum = InputBox("Enter Trip Number to Delete:", "Delete Trip") Loop UserSpace = InStr(UserNum, "test") If UserSpace < 0 Then UserNum = Left(UserNum, UserSpace - 1) End If Dim BegNum As Long Dim EndNum As Long EndNum = UserNum * 24 + 1 BegNum = EndNum - 23 Rows(& BegNum:& EndNum).EntireRow.Delete Shift:=xlUp End Sub "Don Guillett" wrote in message ... Ah, OK. "Trevor Shuttleworth" wrote in message ... Don it's not the winning that counts, it's the taking part ;-) Regards Trevor "Don Guillett" wrote in message ... Trevor, You may have been faster but I deleted more rows. <G "Trevor Shuttleworth" wrote in message ... Jim Sub TestDeleteRows() Dim RowCounter As Long RowCounter = 10 Rows("4:" & RowCounter).EntireRow.Delete End Sub works for me Regards Trevor "Jim" wrote in message ... Im trying to select, then delete a whole lod of rows in one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows withTWO variables
Arielle
you would be better off starting a new thread. However, I assume it is just the last line that is a problem. Try: Rows(BegNum & ":" & EndNum).EntireRow.Delete Regards Trevor "Arielle" wrote in message om... I cannot get this to work for 2 variables - please advise: (goal is to get user input, perform calculations on input and use those row numbers as rows to delete from:to) Sub RowDel() Dim UserSpace As Integer Do Until UserNum < "" UserNum = InputBox("Enter Trip Number to Delete:", "Delete Trip") Loop UserSpace = InStr(UserNum, "test") If UserSpace < 0 Then UserNum = Left(UserNum, UserSpace - 1) End If Dim BegNum As Long Dim EndNum As Long EndNum = UserNum * 24 + 1 BegNum = EndNum - 23 Rows(& BegNum:& EndNum).EntireRow.Delete Shift:=xlUp End Sub "Don Guillett" wrote in message ... Ah, OK. "Trevor Shuttleworth" wrote in message ... Don it's not the winning that counts, it's the taking part ;-) Regards Trevor "Don Guillett" wrote in message ... Trevor, You may have been faster but I deleted more rows. <G "Trevor Shuttleworth" wrote in message ... Jim Sub TestDeleteRows() Dim RowCounter As Long RowCounter = 10 Rows("4:" & RowCounter).EntireRow.Delete End Sub works for me Regards Trevor "Jim" wrote in message ... Im trying to select, then delete a whole lod of rows in one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting rows withTWO variables
Thanks Trevor!
"Trevor Shuttleworth" wrote in message ... Arielle you would be better off starting a new thread. However, I assume it is just the last line that is a problem. Try: Rows(BegNum & ":" & EndNum).EntireRow.Delete Regards Trevor "Arielle" wrote in message om... I cannot get this to work for 2 variables - please advise: (goal is to get user input, perform calculations on input and use those row numbers as rows to delete from:to) Sub RowDel() Dim UserSpace As Integer Do Until UserNum < "" UserNum = InputBox("Enter Trip Number to Delete:", "Delete Trip") Loop UserSpace = InStr(UserNum, "test") If UserSpace < 0 Then UserNum = Left(UserNum, UserSpace - 1) End If Dim BegNum As Long Dim EndNum As Long EndNum = UserNum * 24 + 1 BegNum = EndNum - 23 Rows(& BegNum:& EndNum).EntireRow.Delete Shift:=xlUp End Sub "Don Guillett" wrote in message ... Ah, OK. "Trevor Shuttleworth" wrote in message ... Don it's not the winning that counts, it's the taking part ;-) Regards Trevor "Don Guillett" wrote in message ... Trevor, You may have been faster but I deleted more rows. <G "Trevor Shuttleworth" wrote in message ... Jim Sub TestDeleteRows() Dim RowCounter As Long RowCounter = 10 Rows("4:" & RowCounter).EntireRow.Delete End Sub works for me Regards Trevor "Jim" wrote in message ... Im trying to select, then delete a whole lod of rows in one go. Im trying to use the following commands: Rows("4:" & count_y ).Select Selection.Delete Shift:=xlUp It doesn't like this at all. How can I get it to do what I want? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find a single value from tables by selecting two variable inputs? | Excel Worksheet Functions | |||
Selecting a variable print area in a macro | Excel Discussion (Misc queries) | |||
macro syntax for selecting variable range | Excel Discussion (Misc queries) | |||
Selecting Variable Data Ranges | Excel Discussion (Misc queries) | |||
after selecting 50 rows of a column i can't reference the cells in the rows | New Users to Excel |