LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Help with code (delete range)

Hi all,

I want a macro to start at a certain point, move down to the end of the text
and delete the empty space between it and the next populated cells.

Not delete rows, rahter delete cells, shifting up.

I've written:

Sub testdelete()

Range("C5").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Offset(-1, 0).Select
ActiveCell.Offset(0, 6).Select
Selection.Delete Shift:=xlUp
Range("C11").Select
End Sub

This doesn't work because the .select sets up a new selection rather than
manipulating the old one.

I appreciate this is rookie stuff, but I don't write much VBA, so I've never
got very good at it.

Any ideas gratefully received.

Cheers.
 
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
Code to Delete Range Names Sean Excel Programming 3 January 3rd 07 11:05 PM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
Code to delete a Line in a another code helmekki[_88_] Excel Programming 1 August 8th 05 01:14 AM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM
VBA code to delete VBA code in another Workbook Chip Pearson Excel Programming 0 September 15th 03 03:54 PM


All times are GMT +1. The time now is 12:28 PM.

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

About Us

"It's about Microsoft Excel"