PC Review


Reply
Thread Tools Rate Thread

Cut merged cells

 
 
Woodi2
Guest
Posts: n/a
 
      12th Apr 2009
I have some code that removes data from one sheet and pastes it to another.
The format has changed since i first created it and now involves merged
cells.
The code below would copy the entire row of the active cell and paste it in
the last row of another sheet, then go back to the original sheet and delete
the now empty row.
My problem is the Active cell is now merged and contains 3 cells. When I
run the code, it only deletes the first row but should include the 2 rows
beneath it as well.

ActiveCell.EntireRow.Copy
Sheets("Backloaded Equipment").Select
Range("B2").End(xlDown).Select
ActiveCell.Offset(1, -1).Select
ActiveSheet.Paste
Sheets("Onboard CPF ").Select
ActiveCell.EntireRow.Delete


 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      12th Apr 2009
Oh no!! Merged cells!! I think you are going to have to un-merge those
things before you can do anything significant. I used to use merged cells,
from time to time, but I don't do it any more. Those merged cells cause so
many more problems than they solve.

Maybe someone will come along with an eloquent solution. I's say, un-merge
the cells and then do what you want to do. I can tell that you are already
well acquainted with VBA; you should be able to get it working once those
cells are un-merged.

Good luck,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Woodi2" wrote:

> I have some code that removes data from one sheet and pastes it to another.
> The format has changed since i first created it and now involves merged
> cells.
> The code below would copy the entire row of the active cell and paste it in
> the last row of another sheet, then go back to the original sheet and delete
> the now empty row.
> My problem is the Active cell is now merged and contains 3 cells. When I
> run the code, it only deletes the first row but should include the 2 rows
> beneath it as well.
>
> ActiveCell.EntireRow.Copy
> Sheets("Backloaded Equipment").Select
> Range("B2").End(xlDown).Select
> ActiveCell.Offset(1, -1).Select
> ActiveSheet.Paste
> Sheets("Onboard CPF ").Select
> ActiveCell.EntireRow.Delete
>
>

 
Reply With Quote
 
Woodi2
Guest
Posts: n/a
 
      12th Apr 2009
Thanks for that. I took your advice and "unmerged" everything. Works fine
now.

"ryguy7272" wrote:

> Oh no!! Merged cells!! I think you are going to have to un-merge those
> things before you can do anything significant. I used to use merged cells,
> from time to time, but I don't do it any more. Those merged cells cause so
> many more problems than they solve.
>
> Maybe someone will come along with an eloquent solution. I's say, un-merge
> the cells and then do what you want to do. I can tell that you are already
> well acquainted with VBA; you should be able to get it working once those
> cells are un-merged.
>
> Good luck,
> Ryan---
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Woodi2" wrote:
>
> > I have some code that removes data from one sheet and pastes it to another.
> > The format has changed since i first created it and now involves merged
> > cells.
> > The code below would copy the entire row of the active cell and paste it in
> > the last row of another sheet, then go back to the original sheet and delete
> > the now empty row.
> > My problem is the Active cell is now merged and contains 3 cells. When I
> > run the code, it only deletes the first row but should include the 2 rows
> > beneath it as well.
> >
> > ActiveCell.EntireRow.Copy
> > Sheets("Backloaded Equipment").Select
> > Range("B2").End(xlDown).Select
> > ActiveCell.Offset(1, -1).Select
> > ActiveSheet.Paste
> > Sheets("Onboard CPF ").Select
> > ActiveCell.EntireRow.Delete
> >
> >

 
Reply With Quote
 
Barb Reinhardt
Guest
Posts: n/a
 
      12th Apr 2009
Have you tried

ActiveCell.MergeArea.EntireRow.Delete

FWIW, I also avoid merged cells like the plague.

HTH,
Barb Reinhardt

"Woodi2" wrote:

> I have some code that removes data from one sheet and pastes it to another.
> The format has changed since i first created it and now involves merged
> cells.
> The code below would copy the entire row of the active cell and paste it in
> the last row of another sheet, then go back to the original sheet and delete
> the now empty row.
> My problem is the Active cell is now merged and contains 3 cells. When I
> run the code, it only deletes the first row but should include the 2 rows
> beneath it as well.
>
> ActiveCell.EntireRow.Copy
> Sheets("Backloaded Equipment").Select
> Range("B2").End(xlDown).Select
> ActiveCell.Offset(1, -1).Select
> ActiveSheet.Paste
> Sheets("Onboard CPF ").Select
> ActiveCell.EntireRow.Delete
>
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      13th Apr 2009
If you use the top left cell of the merge area you can do it like this.

Sub dk()
Range("B2").MergeArea.EntireRow.Delete
End Sub




"Woodi2" <(E-Mail Removed)> wrote in message
news:7876E04F-5469-4E6A-8BB2-(E-Mail Removed)...
> Thanks for that. I took your advice and "unmerged" everything. Works
> fine
> now.
>
> "ryguy7272" wrote:
>
>> Oh no!! Merged cells!! I think you are going to have to un-merge those
>> things before you can do anything significant. I used to use merged
>> cells,
>> from time to time, but I don't do it any more. Those merged cells cause
>> so
>> many more problems than they solve.
>>
>> Maybe someone will come along with an eloquent solution. I's say,
>> un-merge
>> the cells and then do what you want to do. I can tell that you are
>> already
>> well acquainted with VBA; you should be able to get it working once those
>> cells are un-merged.
>>
>> Good luck,
>> Ryan---
>>
>> --
>> Ryan---
>> If this information was helpful, please indicate this by clicking
>> ''Yes''.
>>
>>
>> "Woodi2" wrote:
>>
>> > I have some code that removes data from one sheet and pastes it to
>> > another.
>> > The format has changed since i first created it and now involves merged
>> > cells.
>> > The code below would copy the entire row of the active cell and paste
>> > it in
>> > the last row of another sheet, then go back to the original sheet and
>> > delete
>> > the now empty row.
>> > My problem is the Active cell is now merged and contains 3 cells. When
>> > I
>> > run the code, it only deletes the first row but should include the 2
>> > rows
>> > beneath it as well.
>> >
>> > ActiveCell.EntireRow.Copy
>> > Sheets("Backloaded Equipment").Select
>> > Range("B2").End(xlDown).Select
>> > ActiveCell.Offset(1, -1).Select
>> > ActiveSheet.Paste
>> > Sheets("Onboard CPF ").Select
>> > ActiveCell.EntireRow.Delete
>> >
>> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with pasting special merged cells to merged cells ritpg Microsoft Excel Programming 3 9th Mar 2010 07:14 PM
Copy paste non merged to merged cells jamalhakem@gmail.com Microsoft Excel Worksheet Functions 1 5th Feb 2009 05:25 PM
Autofit Merged cell Code is changing the format of my merged cells =?Utf-8?B?SkI=?= Microsoft Excel Misc 0 20th Aug 2007 02:12 PM
how do i link merged cells to a merged cell in another worksheet. =?Utf-8?B?aWJibQ==?= Microsoft Excel Worksheet Functions 3 27th Apr 2006 11:40 PM
Sorting merged cellsHow do I sort merged cells not identically siz =?Utf-8?B?TGF2YWw=?= Microsoft Excel Worksheet Functions 1 3rd Nov 2004 09:40 PM


Features
 

Advertising
 

Newsgroups
 


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