Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find a single value from tables by selecting two variable inputs? jj023 Excel Worksheet Functions 8 February 17th 10 01:40 AM
Selecting a variable print area in a macro Surrealest Excel Discussion (Misc queries) 2 June 7th 09 07:08 AM
macro syntax for selecting variable range Matt Excel Discussion (Misc queries) 1 October 31st 07 07:13 PM
Selecting Variable Data Ranges rc Excel Discussion (Misc queries) 2 May 18th 07 08:26 PM
after selecting 50 rows of a column i can't reference the cells in the rows Bob Salzer New Users to Excel 2 July 21st 06 10:29 PM


All times are GMT +1. The time now is 06:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"