+ Reply to Thread
Results 1 to 7 of 7

Getting compile error 1004

  1. #1
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Getting compile error 1004

    Hi friends,

    I want to merge cells if the column ‘B, d, f, h, j, l, n, p, r, w’ are blank.
    If column ‘B’ is blank then merge columns ‘A:B’.
    If column ‘d’ is blank then merge columns c:d’.
    If column ‘f’ is blank then merge columns ‘e:f’.
    If column ‘h’ is blank then merge columns ‘g:h’.
    If column ‘j’ is blank then merge columns ‘i:j’.
    If column ‘l’ is blank then merge columns ‘k:l’.
    If column ‘n’ is blank then merge columns ‘m:n’.
    If column ‘p’ is blank then merge columns ‘o:p’.
    If column ‘r’ is blank then merge columns ‘q:r’.
    If column ‘w’ is blank then merge columns ‘v:w’.

    I want to repeat it for each subject ‘s1:s9 and t’.
    The range of marks is row 26, 44, 62, 80, 98 and so on skipping 17 rows endlessly as per the students in the class.

    I’m getting compile error 1004.

    Any help will be highly appreciated.

    Thanking you in anticipation.
    Attached Files Attached Files
    Sincerely,

    mso3

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Getting compile error 1004

    Hello mso3,

    You can not check if an entire entire column is empty or merge cells in two columns row by row in VBA using this syntax.
    Please Login or Register  to view this content.
    This macro has been added to the attached workbook. It will merge the cells in the columns as you asked.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Getting compile error 1004

    Hi Leith Ross,
    Excellent! Excellent! Excellent!

    What a great solution!

    It's working absolutely fine beyond my imagination.

    I by heart appreciate you for the challenging solution.

    Thank you and have a nice day.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Getting compile error 1004

    Hello mso3,

    You're welcome. Glad I could help out.

  5. #5
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Getting compile error 1004

    Hi Leith Ross,

    The code is working fine but I want to merge the cells in center. I used

    Please Login or Register  to view this content.
    But it’s not working. I’m getting compile error ‘variable not define’ on the word ‘center’.

    Therefore, I request you to do amend the code to merge and center the cells positively.

    Thank you and sorry for trouble.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Getting compile error 1004

    Hello mso3,

    Here is the updated macro. The change s are in blue.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-29-2014
    Location
    India
    MS-Off Ver
    2010 Windows 10 64 bits
    Posts
    1,269

    Re: Getting compile error 1004

    Hi Leith Ross,
    Perfect! Now it's working fine.

    Thank you and have a nice time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Getting compile error 1004 unable to set the hidden property of range class
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2015, 10:21 AM
  2. Getting compile error 1004 class method fail
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2015, 11:34 PM
  3. [SOLVED] Getting compile error 1004
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2015, 06:46 PM
  4. Compile error 1004
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2014, 10:35 PM
  5. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM

Tags for this Thread

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