+ Reply to Thread
Results 1 to 7 of 7

Small Changes to Code

  1. #1
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Small Changes to Code

    I'm afraid this is a very noobie question, any insight is greatly appreciated. I would like to change this code so that instead of
    Please Login or Register  to view this content.
    it copies cells 3:1112 of whatever column it is in. Then instead of
    Please Login or Register  to view this content.
    I would like it to select cell D4. I just can't get the syntax right to make this happen and I've confused myself into a corner. I know it must be simple.

    Here is the code:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Small Changes to Code

    Maybe this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Small Changes to Code

    Hi Stnkynts,
    This is great. The first part is fixed & I see what I was doing wrong, this is a huge help in understanding what I'm doing, thank you. But when I get to line
    Please Login or Register  to view this content.
    I get "Runtime error 438: Object doesn't support this property or method". The destination sheet is literally blank cells with nothing to get in the way.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Small Changes to Code

    I didn't want to stray from your code too much but when you are accessing multiple workbooks/sheets you really need to reference them by name. It makes sure the code know exactly where to apply what.

    It is a little challenging for me to test this code so I hope I didn't forget anything:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Small Changes to Code

    Thanks for getting back to me! I see what you mean & referencing the documents directly & how that will be beneficial. Thank you! I'm trying to figure that out. I keep getting "Compile error: Syntax Error" when I try it. It gets stuck at the Set ws1 point.

    Updated based on your last post, I pasted the code below & I also attached the files I am working with. The macro I'm trying to run is in the Cost Template named "Create_PO". Thanks for your patience with me! I am learning a ton from this forum and nice people like you.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Small Changes to Code

    The reason you got the syntax error is because when defining a workbook you need to include some language. :

    Please Login or Register  to view this content.
    In addition, I was not able to open your attached Cost Template 2014 file. I would verify that you attached the correct and working version and resubmit.

    Either way I updated your code. I may have missed something (It's getting late and my eyes are tired). If it errors on you let me know.

  7. #7
    Registered User
    Join Date
    04-26-2011
    Location
    Saint Louis, MO
    MS-Off Ver
    Excel 2003
    Posts
    33

    Re: Small Changes to Code

    Thank you Stnkynts. I see what you changed & it makes sense now. I will try this today. I was having a lot of trouble getting the Cost Template to upload because it was .xltm. I had to change it to .xlsm in order to upload it. I will try my best with this new code first before bothering you with a new upload. Thank you for making your eyes red and tired looking at my stuff. I am extremely grateful!

+ 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. Can someone tweak a small vba code for me?
    By boniouk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2013, 07:35 AM
  2. [SOLVED] VBA - If statement and small piece of code
    By conorcleary in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-17-2012, 11:34 AM
  3. Can this small bit of code be combined to one line of code?
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2011, 02:00 AM
  4. Very slow small vba code
    By jpruffle in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-27-2009, 12:33 PM
  5. VBA Print Code Is Too Small
    By Minitman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2006, 02:30 PM

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