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


Please help me with this

Public Sub NamesAtTheTopOfTheTable()
Dim rng1 As Range
Dim rng2 As Range

With ThisWorkbook
Set rng1 = .Sheets("Totals").Range("F5:BM5") '<<== CHANGE
Set rng2 = .Sheets("test").Range("F5:BM5") '<<== CHANGE
End With

rng2.Copy Destination:=rng2

End Sub

I my cells are merged in pairs and when I do this copy the cells in
both ranges
become unmerged and the text shifts to the left running out of the
range.
Then I need to manually remerge each pair of cells.


--
SuitedAces
------------------------------------------------------------------------
SuitedAces's Profile: http://www.excelforum.com/member.php...o&userid=35840
View this thread: http://www.excelforum.com/showthread...hreadid=558627

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with code for merged cells


First, I take it you meant

rng1.Copy Destination:=rng2

?

Try, immediately after this line, using:

rng2.merge


Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=558627

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with code for merged cells


That won't work because I have 60 cell and the are merged in pairs.
When I used that line of code it merges all the cells together and want
to
only take the data for the left most cell.


--
SuitedAces
------------------------------------------------------------------------
SuitedAces's Profile: http://www.excelforum.com/member.php...o&userid=35840
View this thread: http://www.excelforum.com/showthread...hreadid=558627

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with code for merged cells


That won't work because I have 60 cell and the are merged in pairs.
When I used that line of code it merges all the cells together and
wants to
only take the data for the left most cell.


--
SuitedAces
------------------------------------------------------------------------
SuitedAces's Profile: http://www.excelforum.com/member.php...o&userid=35840
View this thread: http://www.excelforum.com/showthread...hreadid=558627

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with code for merged cells


Col

I have a sub that loops through all the cells and merges them in
pairs.


Thank you for the help.


--
SuitedAces
------------------------------------------------------------------------
SuitedAces's Profile: http://www.excelforum.com/member.php...o&userid=35840
View this thread: http://www.excelforum.com/showthread...hreadid=558627



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with code for merged cells


That won't work because I have 60 cell and the are merged in pairs.
When I used that line of code it merges all the cells together and
wants to
only take the data for the left most cell.


--
SuitedAces
------------------------------------------------------------------------
SuitedAces's Profile: http://www.excelforum.com/member.php...o&userid=35840
View this thread: http://www.excelforum.com/showthread...hreadid=558627

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
merged cells - code glitch Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 9 October 10th 07 09:27 PM
Autofit Merged cell Code is changing the format of my merged cells JB Excel Discussion (Misc queries) 0 August 20th 07 02:12 PM
changing merged cells from code john Excel Programming 7 July 6th 05 10:24 PM
Code doesn't work on merged cells IC[_2_] Excel Programming 8 September 10th 04 12:55 PM
Merged Cells Autofit - code amendment roy Excel Programming 7 November 4th 03 12:19 PM


All times are GMT +1. The time now is 12:31 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"