Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Cut merged cells

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Cut merged cells

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Cut merged cells

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Cut merged cells

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Cut merged cells

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" wrote in message
...
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
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
Copy paste non merged to merged cells [email protected] Excel Worksheet Functions 1 February 5th 09 05:25 PM
How can I sort an Excel Doc containing merged & non-merged cells? KellyH Excel Discussion (Misc queries) 11 June 10th 08 04:12 AM
Autofit Merged cell Code is changing the format of my merged cells JB Excel Discussion (Misc queries) 0 August 20th 07 02:12 PM
how do i link merged cells to a merged cell in another worksheet. ibbm Excel Worksheet Functions 3 April 27th 06 11:40 PM
Sorting merged cellsHow do I sort merged cells not identically siz Laval Excel Worksheet Functions 1 November 3rd 04 09:40 PM


All times are GMT +1. The time now is 08:25 AM.

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

About Us

"It's about Microsoft Excel"