+ Reply to Thread
Results 1 to 6 of 6

Adding LastColumn to Macro not working

  1. #1
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Adding LastColumn to Macro not working

    I am tring to add last column to my SubCleanAll2 but I get "Type Mismatch" at this point in the 2nd Sub
    Please Login or Register  to view this content.
    I want to start on column H row two or H2

    The 1st Sub works the 2nd does not

    Thanks
    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Adding LastColumn to Macro not working

    Seems to be a sub/function missing - NumbersOnly.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Adding LastColumn to Macro not working

    Forgot to add that part

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Adding LastColumn to Macro not working

    I can't see why you would get the type mismatch error, probably need to see some data for that.

    Don't think it's got anything to do with lastCol though.

    There are a few other errors in the code that could cause problems.

    For example,
    Please Login or Register  to view this content.
    here there's no sheet reference for Cells(2,8) and Cells(lastRow, lastCol) so the code will fail unless Sheets(1) is active.

    To avoid the problem you can use this.
    Please Login or Register  to view this content.
    [/code]

    There's a similar error on the last line of the code with a similar solution.

    What's the purpose of the code anyway?

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  5. #5
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Adding LastColumn to Macro not working

    Thank you again that fixed the problem

  6. #6
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    927

    Re: Adding LastColumn to Macro not working


+ 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. Replies: 1
    Last Post: 11-07-2012, 10:05 PM
  2. adding cell = macro not working
    By w_lred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2008, 03:52 PM
  3. Dim Lastrow ? Dim LastColumn
    By khalid79m in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2008, 01:43 PM
  4. LastColumn used as letter(s) in VBA
    By GALLAGHE in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-26-2006, 08:55 AM
  5. Select from lastrow to lastcolumn
    By poppy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-20-2005, 08:57 AM

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