+ Reply to Thread
Results 1 to 12 of 12

Unable to select columns with columns.("D:D").select

  1. #1
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Unable to select columns with columns.("D:D").select

    Hi this is really starting to annoy me now. Everytime I try to select a column in VBA I get runtime error 1004 "Select method of range class faailed" I'm sure I'm just being an idiot but nothing seems work. I've tried different versions of the same thing but they don't work. Am i doing something really stupid? I've included my code just in case. Thanks.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Unable to select columns with columns.("D:D").select

    use Range instead of Columns. ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: Unable to select columns with columns.("D:D").select

    Thanks for replying but same problem.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Unable to select columns with columns.("D:D").select

    Oh-your code is in a worksheet module so if you refer to Range or Columns without specifying a worksheet it refers to the sheet containing the code and you can't select anything on that sheet unless it is active.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: Unable to select columns with columns.("D:D").select

    Told you I was stupid! does that make a difference?

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Unable to select columns with columns.("D:D").select

    what - being stupid? :-P

  7. #7
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: Unable to select columns with columns.("D:D").select

    hehehe cheers. I REALLY appreciate that (and the houmour!) Thanks for your help.
    Its orking great appart from it dosn't seem to put the formula into column D

    Please Login or Register  to view this content.
    I need the formula =c2-today()-182 to be in cells D2 down to last used row but increasing c2 like dragging right corner. Any ideas?

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Unable to select columns with columns.("D:D").select

    sorry - could not resist!
    change the last 3 lines to
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: Unable to select columns with columns.("D:D").select

    sorry? I've currently got

    Please Login or Register  to view this content.
    which puts the formula into d1 and d2 but thats all.

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Unable to select columns with columns.("D:D").select

    in that case you have the wrong sheet active when this runs
    Please Login or Register  to view this content.
    change that to
    Please Login or Register  to view this content.
    or better
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: Unable to select columns with columns.("D:D").select

    You genius!!!!! Thanks thats brilliant. I can now get the main part done from there. Thank you again.

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Unable to select columns with columns.("D:D").select

    glad to be of service.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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