+ Reply to Thread
Results 1 to 11 of 11

Need help with my macro "Sub or function not defined"

  1. #1
    Registered User
    Join Date
    04-15-2017
    Location
    australia
    MS-Off Ver
    office 365
    Posts
    46

    Need help with my macro "Sub or function not defined"

    Hello everyone, first off, Merry Christmas!

    Now.. Basically i am trying to make a macro that does many things at once (I am very new to excel and VBA as you will probably tell once you see my code lol.

    I want the macro to do all of these things in this order:

    1) save the current workbook
    2) Unhide the sheet called "next"
    3) Unprotect all sheets in the workbook (the password is password)
    4) Add + 1 to Range C3 from "summary"
    5) I then have to copy and paste (values only) of 3 different ranges to 3 different locations (as you can see in my attempt below)
    6) Then i need to clear the contents of a whole bunch of ranges (as you can see in my attempt below)
    7) Hide sheet "next" again.
    8) Protect all my sheets in the workbook again (the password is password)
    9) I then want to SAVE AS to "C:\Users\Spreads\ and name it "Admin" + B3 + C3 as xlsx (As you can see in my attempt below at the bottom)

    I tried to run this macro and i get the error "Sub or function not defined", i have no idea what this means :/

    Also; I feel like there has to be a quicker and shorter way to write that code, but im just too inexperienced to know how.
    If anyone wishes to help me with this it would be greatly appreciated, If you do try to rewrite it, i don't expect you to put all my values in for me,
    You can just use a symbol such as # or $ and i can fill them in myself, thankyou very much and Merry Christmas again!


    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Need help with my macro "Sub or function not defined"

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-15-2017
    Location
    australia
    MS-Off Ver
    office 365
    Posts
    46

    Re: Need help with my macro "Sub or function not defined"

    Hell Jindon, I tried that also, Do you know why my clear contents is converting my table back to range and stuffing up everything?

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Need help with my macro "Sub or function not defined"

    Wasn't your question
    Re: Need help with my macro "Sub or function not defined"
    ?

    I didn't read all through your codes....

  5. #5
    Registered User
    Join Date
    04-15-2017
    Location
    australia
    MS-Off Ver
    office 365
    Posts
    46

    Re: Need help with my macro "Sub or function not defined"

    My Question was to get this code to work, sorry if i worded it wrong.

  6. #6
    Registered User
    Join Date
    04-15-2017
    Location
    australia
    MS-Off Ver
    office 365
    Posts
    46

    Re: Need help with my macro "Sub or function not defined"

    Please Login or Register  to view this content.
    This line is converting my table to a range for an unknown reason, and every other table doesnt change
    Last edited by jeffreybrown; 12-25-2017 at 10:11 AM. Reason: Please use code tags!

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Need help with my macro "Sub or function not defined"

    If the code is not working properly, we can not even guess what you are trying to do.

    If you upload a workbook with before/after clearly showing the logic, it may help.



    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  8. #8
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Need help with my macro "Sub or function not defined"

    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Need help with my macro "Sub or function not defined"

    As Paul has already pointed out, before we can proceed, please follow the forum rules and annotate your cross post with the appropriate links so no one is duplicating the help you receive elsewhere.
    HTH
    Regards, Jeff

  10. #10
    Registered User
    Join Date
    04-15-2017
    Location
    australia
    MS-Off Ver
    office 365
    Posts
    46

    Re: Need help with my macro "Sub or function not defined"

    sorry ill mark as solved

  11. #11
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Need help with my macro "Sub or function not defined"

    Thanks joepekimo and Merry Christmas.

+ 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. replace all defined range names in the sheet that start with "Street" to "Road"
    By matrex in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-04-2016, 08:53 AM
  2. [SOLVED] Macro Button error ("user-defined type not defined")
    By brad.hodge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2016, 10:26 AM
  3. [SOLVED] Code works in the macro but not in a separate function. "Sub or function not defined."
    By tahi.laci in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-28-2014, 12:38 PM
  4. Replies: 1
    Last Post: 05-06-2013, 06:07 AM
  5. [SOLVED] Using the MOD function in a "User" defined macro
    By Vba Novice in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-11-2013, 04:20 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