Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete all negative numbers leaving only positive numbers | Excel Discussion (Misc queries) | |||
locate positive numbers and delete rows containing | Excel Discussion (Misc queries) | |||
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows | Excel Worksheet Functions | |||
Extend Border As User Inputs New Rows | Excel Discussion (Misc queries) | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions |