Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Merge Cells run-time error '1004'

Could anyone help me about the problem with this line of Macro?

Worksheets("DIFF").Range(Cells(CommonRowInd, CommonColInd),
Cells(CommonRowInd + 1, CommonColInd)).Select
Selection.Merge

When I debug, CommonRowInd is 1 and CommonColInd is 25 (as expected). I try
to merge two cells, but I have this problem.

Any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
mcg mcg is offline
external usenet poster
 
Posts: 18
Default Merge Cells run-time error '1004'


darxoul napisal(a):
Could anyone help me about the problem with this line of Macro?

Worksheets("DIFF").Range(Cells(CommonRowInd, CommonColInd),
Cells(CommonRowInd + 1, CommonColInd)).Select
Selection.Merge

When I debug, CommonRowInd is 1 and CommonColInd is 25 (as expected). I try
to merge two cells, but I have this problem.

Any suggestions?


is Worksheets("DIFF") active worksheet?
it should be active to select
if its active u can
...... RowInd, CommonColInd), Cells(CommonRowInd + 1,
CommonColInd)).Merge
without selecting it
mcg

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Merge Cells run-time error '1004'

Sub abc()
CommonRowInd = 1
CommonColInd = 25
With Worksheets("DIFF")
.Range(.Cells(CommonRowInd, CommonColInd), _
.Cells(CommonRowInd + 1, CommonColInd)).Merge
End With
End Sub

worked fine for me on a new sheet. It didn't require the the sheet DIFF be
active.

--
Regards,
Tom Ogilvy



"darxoul" wrote:

Could anyone help me about the problem with this line of Macro?

Worksheets("DIFF").Range(Cells(CommonRowInd, CommonColInd),
Cells(CommonRowInd + 1, CommonColInd)).Select
Selection.Merge

When I debug, CommonRowInd is 1 and CommonColInd is 25 (as expected). I try
to merge two cells, but I have this problem.

Any suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Merge Cells run-time error '1004'

Yes, it works this way.

Thanks a lot.

But why?

"Tom Ogilvy" wrote:

Sub abc()
CommonRowInd = 1
CommonColInd = 25
With Worksheets("DIFF")
.Range(.Cells(CommonRowInd, CommonColInd), _
.Cells(CommonRowInd + 1, CommonColInd)).Merge
End With
End Sub

worked fine for me on a new sheet. It didn't require the the sheet DIFF be
active.

--
Regards,
Tom Ogilvy



"darxoul" wrote:

Could anyone help me about the problem with this line of Macro?

Worksheets("DIFF").Range(Cells(CommonRowInd, CommonColInd),
Cells(CommonRowInd + 1, CommonColInd)).Select
Selection.Merge

When I debug, CommonRowInd is 1 and CommonColInd is 25 (as expected). I try
to merge two cells, but I have this problem.

Any suggestions?

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
Run-time error '1004': Method 'Cells' of object _Global failed Fran D[_6_] Excel Programming 3 May 12th 06 04:44 PM
Run-time error 1004: Cannot shift nonblank cells off the worksheet [email protected] Excel Discussion (Misc queries) 1 April 10th 06 06:13 PM
Microsoft Visual Basic Run-time error '1004' No cells were found Paul Riker Excel Programming 8 July 28th 05 05:53 AM
Run-time error '1004': No cells were found Jamie Excel Programming 0 May 16th 05 11:01 PM
Run-time error '1004': No cells were found Jamie Excel Programming 0 May 16th 05 10:52 PM


All times are GMT +1. The time now is 04:59 PM.

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"