+ Reply to Thread
Results 1 to 4 of 4

Merge Cells run-time error '1004'

  1. #1
    darxoul
    Guest

    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. #2
    mcg
    Guest

    Re: 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. #3
    Tom Ogilvy
    Guest

    RE: 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. #4
    darxoul
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1