+ Reply to Thread
Results 1 to 5 of 5

Unable to re-title a macro

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Unable to re-title a macro

    Hi ,

    I'm trying to copy a macro and change the details to behave slightly differently. However, it does not like the similar title and when I try to update the title it wont activate.
    Can anyone help?

    the code is this:
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    can anyone help or advise
    Last edited by 6StringJazzer; 07-07-2016 at 08:51 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Unable to re-title a macro

    A Sub called Worksheet_Change in a worksheet module is automatically called by VBA whenever there is a change to a cell static value or formula in that worksheet. It must have the same name and arguments. If the name is different, VBA will not call it. If the arguments are different, it will not compile.

    "change the details to behave slightly differently." What are you trying to change? Why do you want a copy with a different name, instead of just updating this one?

    "it does not like the similar title" What does this mean? What is the similar title? What happens?
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Unable to re-title a macro

    Oh I see, I could put the same argument in here then? I just need another if command in here after the line:

    [Range("C16").Value = "-22.5"]

    for example, if I choose 1800 (as opposed to 750 in the opening line) I would need to change the :

    [If Range("C5").Value = 750 Then
    Range("C4").Value = 54
    Range("C6").Value = "P"
    Range("C3").Value = "SQUARE"
    Range("C8").Value = "UNBRAKED"
    Range("C7").Value = "4/100"
    Range("D7").Value = "4100"
    Range("C10").Value = "100"
    Range("C11").Value = "FORGED"
    Range("C12").Value = "0"
    Range("C13").Value = "0"
    Range("C14").Value = "0"
    Range("C15").Value = "1"
    Range("C9").Value = "NO BRAKE"
    Range("C16").Value = "-22.5"]


    so another if command could exist in this argument?

  4. #4
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Unable to re-title a macro

    Ok, i've got it now, it was as you said. Drop another If argument into the existing one.

    Thanks you

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Unable to re-title a macro

    Please go back and read my note in your first post about code tags. You should review all our rules (it's a short list) and go back and edit post #3 to use CODE tags instead of using [brackets] around your code.

    I think you have the right idea but you are confusing several terms.

    The argument is the variable inside the parentheses of the Sub declaration.

    The If construct is a statement (not a command).

    Yes, you can modify the If statement to look for 1800 instead of 750; you can add an ElseIf to look for 1800 and still keep the existing check for 750.

    Please Login or Register  to view this content.

+ 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. Macro security issue - unable to save as macro enabled sheet
    By agadge123 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-31-2016, 12:36 PM
  2. Macro security issue - unable to save as macro enabled sheet
    By agadge123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2016, 11:05 AM
  3. [SOLVED] Unable to replicate simple macro process/unable to compose simple copy paste macro
    By MattRNR in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-06-2015, 04:51 AM
  4. Replies: 3
    Last Post: 11-08-2012, 07:25 PM
  5. Replies: 12
    Last Post: 08-10-2012, 05:11 PM
  6. Unable to Set Title of First Column in Pivot Table
    By PosseJohn in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-01-2012, 03:29 PM
  7. Replies: 2
    Last Post: 07-21-2006, 05:10 AM

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