vba row function

TrustPilot

starstarstarstarstar Excellent

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA Row Function

VBA Row Function

resolvedResolved · Low Priority · Version 2003

Thu 17 Dec 2009, 16:11 replyReply Delegate Tony said...

VBA Row Function

How do you delete rows using a variable.
Rows("1:5").delete
works but how do you use a variable name

For upcoming training course dates see: Pricing & availability

Fri 18 Dec 2009, 09:08 replyReply Trainer Stephen said...

RE: VBA Row Function

Hi Tony

Thanks for your question

The following code prompts the user to enter a start and finish row and then cocatenates them into a string that is used in the delete method

Sub RowDeleter()

Dim intStart As Integer
Dim intFinish As Integer
Dim strDelete As String

intStart = InputBox("Enter Start Row")
intFinish = InputBox("Enter Finish Row")

strDelete = intStart & ":" & intFinish

Rows(strDelete).Delete

End Sub


Regards

Stephen


 

Excel tip:

Creating Quick Column Charts

Select the information you want to appear in the chart and press F11. This creates a new chart on a seperate worksheet.

View all Excel hints and tips

 

Live dates & prices

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.