Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 465
Default delete rows between tow inputs numbers


Hi

I need help with a small macro.

I need to enter two numbers in message boxes , and then delete the rows
between the two input numbers.

If the second number is entered as 'last row' , then it would delete
between the first number entered and the bottom row , whatever number
row it may be.

Can someone help with some code?

Grateful for any help.



Best Wishes
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 143
Default delete rows between tow inputs numbers

On Dec 28, 1:40*pm, Colin Hayes wrote:
Hi

I need help with a small macro.

I need to enter two numbers in message boxes , and then delete the rows
between the two input numbers.

If the second number is entered as 'last row' , then it would delete
between the first number entered and the bottom row , whatever number
row it may be.

Can someone help with some code?

Grateful for any help.

Best Wishes


How about:

Sub rowKiller()
Dim n1 As String, n2 As String, s As String
n1 = Application.InputBox(prompt:="enter first row", Type:=2)
n2 = Application.InputBox(prompt:="enter last row", Type:=2)
If n2 = "last row" Then
n2 = CStr(Rows.Count)
End If
s = n1 & ":" & n2
Rows(s).Delete
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 465
Default delete rows between tow inputs numbers

In article
,
James Ravenswood writes
How about:

Sub rowKiller()
Dim n1 As String, n2 As String, s As String n1 = Application.InputBox(prompt:="en
ter first row",
Type:=2) n2 = Application.InputBox(prompt:="enter last row", Type:=2)
If n2 = "last row" Then
n2 = CStr(Rows.Count)
End If
s = n1 & ":" & n2
Rows(s).Delete
End Sub



HI James

OK thanks for that. It works perfectly first time.

^_^


Best Wishes ,
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default delete rows between tow inputs numbers

On Dec 28, 4:05*pm, Colin Hayes wrote:
In article
,
James Ravenswood writes

How about:


Sub rowKiller()
Dim n1 As String, n2 As String, s As String n1 = Application.InputBox(prompt:="en
ter first row",
Type:=2) n2 = Application.InputBox(prompt:="enter last row", Type:=2)
If n2 = "last row" Then
* *n2 = CStr(Rows.Count)
End If
s = n1 & ":" & n2
Rows(s).Delete
End Sub


HI James

OK thanks for that. It works perfectly first time.

^_^

Best Wishes ,


Maybe excel could be taught to get the correct numbers for you?
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
Delete all negative numbers leaving only positive numbers Barry Walker Excel Discussion (Misc queries) 9 April 2nd 23 07:34 PM
locate positive numbers and delete rows containing Giggly4g Excel Discussion (Misc queries) 3 April 2nd 08 03:47 AM
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Excel Worksheet Functions 0 December 13th 06 01:25 AM
Extend Border As User Inputs New Rows Paperback Writer Excel Discussion (Misc queries) 1 December 1st 06 02:58 PM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM


All times are GMT +1. The time now is 09:54 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"