Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Deleting a range of cells.

Hi Guys,

I have a VBA Macro that works on a sheet and I want to delete from B5 - B17
the problem is that cell A16 is a merged cell (A16 B16 C16)
When I use Range("B5:B17).Select it does not select just the cells in column
B it selects A5 - C5 down to A17- C17.
How can I get it to select only cells B5:B17. If I do it with the mouse
directly on the sheet it allows me to do it and ignores the merged cells.

Your help is appreciated.

Best Regards,

Steve Wilson.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Deleting a range of cells.

Hi Guys,

Sorry, not true,
If I do it with the mouse directly on the sheet it does not allow me to do
it.
If I Mouse Click on Cell B5 and drag to B17 as soon as I pass over the
merged cells at B16 it selects columns A & C also.
Can I get around this?

Thanks,

Steve Wilson.



l...
Hi Guys,

I have a VBA Macro that works on a sheet and I want to delete from B5 -

B17
the problem is that cell A16 is a merged cell (A16 B16 C16)
When I use Range("B5:B17).Select it does not select just the cells in

column
B it selects A5 - C5 down to A17- C17.
How can I get it to select only cells B5:B17. If I do it with the mouse
directly on the sheet it allows me to do it and ignores the merged cells.

Your help is appreciated.

Best Regards,

Steve Wilson.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default Deleting a range of cells.

HI Steve,

The problem is the the way you learned from the macro recorder code. The
extensive use of "Select"is NOT necessary.
Use range( "B5:B17).Clear

In general the code :
asdfsd.select
Selection.do_something
can be replaced by :
asdfasd.do_something


Regards

JY


"Always Learning" <NoMoreSpam@MyEmail wrote in message
...
Hi Guys,

I have a VBA Macro that works on a sheet and I want to delete from B5 -
B17
the problem is that cell A16 is a merged cell (A16 B16 C16)
When I use Range("B5:B17).Select it does not select just the cells in
column
B it selects A5 - C5 down to A17- C17.
How can I get it to select only cells B5:B17. If I do it with the mouse
directly on the sheet it allows me to do it and ignores the merged cells.

Your help is appreciated.

Best Regards,

Steve Wilson.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Deleting a range of cells.

Hi There,

This is a good idea but does not give me what I want. It leaves an empty,
odd looking column.

I have got around this by selecting the merged cells and removing the merge
element. Then I do the range selection and delete.

Works well and gives me what I wanted.

Thanks for your help & time.

Best Regards,


Steve Wilson.

"Jean-Yves" wrote in message
...
HI Steve,

The problem is the the way you learned from the macro recorder code. The
extensive use of "Select"is NOT necessary.
Use range( "B5:B17).Clear

In general the code :
asdfsd.select
Selection.do_something
can be replaced by :
asdfasd.do_something


Regards

JY


"Always Learning" <NoMoreSpam@MyEmail wrote in message
...
Hi Guys,

I have a VBA Macro that works on a sheet and I want to delete from B5 -
B17
the problem is that cell A16 is a merged cell (A16 B16 C16)
When I use Range("B5:B17).Select it does not select just the cells in
column
B it selects A5 - C5 down to A17- C17.
How can I get it to select only cells B5:B17. If I do it with the mouse
directly on the sheet it allows me to do it and ignores the merged

cells.

Your help is appreciated.

Best Regards,

Steve Wilson.






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
Deleting/Clearing duplicate range of cells Steve Excel Worksheet Functions 0 April 28th 10 03:59 PM
MACRO HELP - deleting rows containing a range of blank cells DavidHawes Excel Discussion (Misc queries) 9 February 26th 07 03:40 PM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM
deleting cells in a range JulieD Excel Programming 5 March 25th 05 02:03 AM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


All times are GMT +1. The time now is 09:02 AM.

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"