Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > VB6 and Excel spreadsheet - Delete Unspecified range of cells


Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2008, 02:39 PM
tgifgemini tgifgemini is offline
Regular
 
Join Date: May 2007
Posts: 78
Default VB6 and Excel spreadsheet - Delete Unspecified range of cells



Hello everyone,
just one more thing on my spreadsheet manipulation: Currently I am hard-coding deletion of a range of cells. However, this range may change at any given time, in other words, there is no limited to where the data ends(number of records in the spreadsheet may vary).

For example, this is what I have now.
Code:
Rows("3:1972").Delete Shift:=xlUp
I want it to be dynamic - like so:
Code:
Rows("A3:?????").Delete Shift:=xlUp
Thanks in advance for any help.
tgif
Reply With Quote
  #2  
Old 03-21-2008, 04:29 PM
Colin Legg's Avatar
Colin Legg Colin Legg is offline
Out Of Office

Retired Moderator
* Expert *
 
Join Date: Mar 2005
Location: London, UK
Posts: 3,398
Default

There must be thousands of examples in this board on how to determine the last row within a column. There is even an example in the FAQ section (lesson 2) which you could adapt if it's not too much trouble for you.
You should always do a search before you post a question to see if it has already been answered.

I also see that you have received responses in another forum where you have posted the same question.
The answer you have received (at the moment) is reasonable (but not the best way) so I would recommend looking in the FAQ section as I mentioned earlier.

And again, I reiterate my point on your earlier post about unqualified referencing.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->