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: 1
Default what's wrong?

what's wrong?

Example:
------------------------------------------------------------------------------------Sub
combine_cells()
Dim rngContent As Range
Dim rLastContent As Integer
Dim i As Integer

rLastContent = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row

Set rngContent = Range("B4:G" & rLastContent)

Application.DisplayAlerts = False

For i = 4 To rLastContent
Range("B"&i&":"&"G"&i).Merge
Next

Application.DisplayAlerts = True

End Sub
------------------------------------------------------------------------------------The
above vba is supposed to run in this way:
merge B4:G4
merge B5:G5
merge B6:G6
...
However, NONE of the cells is merged! What's wrong? (question 1)
Can the vba be written in the form of: (question 2)
For Each ... In ...
...
Next
If yes, how to write? (question 3)



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
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
What is wrong with my UDF jlclyde Excel Discussion (Misc queries) 4 October 24th 08 03:06 PM
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
What Am I Doing Wrong comparini3000 Excel Discussion (Misc queries) 1 June 12th 06 05:51 PM
wHAT AM i DOING wrong DMB Excel Worksheet Functions 3 December 27th 05 05:41 PM
What's wrong with this vb? DaveMoore Excel Worksheet Functions 2 February 24th 05 01:29 PM


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