+ Reply to Thread
Results 1 to 15 of 15

Need help modifing / adding to some VBA code

  1. #1
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Need help modifing / adding to some VBA code

    I have a sample file attached. It has working VBA code that's put a "X", in a cell where
    a "q" is in the cell directly to the left (in a hidden column).

    I would like to be able to have an additional column (working the same way) that
    puts a "wingding symbol" in an additional column, the same way (when an "/", is to the left.

    I have attached a sample piece of the file / with the current VBA code.

    If someone can write / edit the code to work, (if it can be done), it would be greatly
    appreciated as I do not fully understand VBA.
    I am using excel 2003.

    Thanks!!!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Need help modifing / adding to some VBA code

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Need help modifing / adding to some VBA code

    When I add this new code it gives me an error. "ambiguous name".

    Do I add this after the "End Sub" of the existing code?
    Or Could you put it all together, (and test it), so I can just paste in "all new code"?
    I just do not get how to add this to the existing

    Thanks again.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Need help modifing / adding to some VBA code

    Just overwrite the existing code - I changed your routine so it needs to be replaced.

  5. #5
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Need help modifing / adding to some VBA code

    No, Maybe I was not clear in the first post, but I need both "Codes" to work, so that the boxes that
    get the Xs, now (My existing code), still works, in addition to the new code.
    I'm not sure, if maybe "my old code needs to be modified" (to add the new working column), or there is
    a way to just "add" this new code. I hope I'm explaining it correctly.

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

    Re: Need help modifing / adding to some VBA code

    Is this how you wanted?
    Please Login or Register  to view this content.
    **fset should be **fset
    Don't know why, but it changes.
    Last edited by jindon; 03-08-2014 at 09:13 AM.

  7. #7
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Need help modifing / adding to some VBA code

    Still cant get it to work. I get a "Syntax Error"

    Can you maybe put the new code into my worksheet, test it, then forward me the "worksheet" with the code already in it?
    I'm sure I'm doing something basic wrong when I paste the new code in.

    Thanks Again.
    Last edited by richard11153; 03-08-2014 at 09:59 AM.

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

    Re: Need help modifing / adding to some VBA code

    Try the attached
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Need help modifing / adding to some VBA code

    This code does both the q and the /.... I modified your existing code to do both. That was what I meant.... not sure why ** was changed to ** in my first post - OR in this post replace each occurence ** star star with the letters Oh and Ef arggghhh,,,
    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 03-08-2014 at 11:51 AM.

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

    Re: Need help modifing / adding to some VBA code

    Or do you mean
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Need help modifing / adding to some VBA code

    The last set of code seems to work fine (It puts both symbols in the columns as I want)
    There is still a problem however; Even though the symbols go in properly, now when
    I highlight a group of cells in another area of the worksheet (as I would do delete some data or entries),
    as soon as I swipe, say 6 cells, I get an error. It pops up a message: "Run time error 13 Mismatched". (Not sure what that means.)
    Then when I hit the "De-Bug" option, It highlights in yellow: "If Not Target.Offset(, -1).Value Like "[q/]" Then"

    Not sure what to make of this?
    Last edited by richard11153; 03-09-2014 at 10:16 AM.

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

    Re: Need help modifing / adding to some VBA code

    Add following one line just below Const line
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Need help modifing / adding to some VBA code

    Beautiful!! You guys amaze me. Thank you so much.

    May I call on you again some time? As I may want to add, even one more column (as this added).

  14. #14
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Need help modifing / adding to some VBA code

    Let me ask another question....
    How would code "be done / be added" to do this again, but maybe putting say, "FE" in a cell, when the column
    directly to the left is say a "Z" (same type of thing). Would you mind showing me that "added in" code?

    Here's what I have so far that works well.

    [Code]
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Const WS_RANGE As String = "a1:bu1450" '<=== change to suit
    If Target.Count > 1 Then Exit Sub
    If Not Target.Offset(, -1).Value Like "[q/]" Then Exit Sub
    Application.EnableEvents = False
    If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
    With Target
    If .Offset(, -1).Value = "q" Then
    .Font.Name = "x"
    .Value = IIf(.Value = "x", "", "x")
    ElseIf .Offset(, -1).Value = "/" Then
    .Font.Name = "Wingdings 2"
    .Value = IIf(.Value = "t", "", "t")
    End If
    .Offset(0, -1).Activate
    End With
    End If
    Application.EnableEvents = True
    End Sub
    [Code]
    Last edited by richard11153; 03-10-2014 at 02:29 PM.

  15. #15
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need help modifing / adding to some VBA code

    Richard, please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ 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. Need Help modifing a MAS to Excel Report - THX!
    By elsoung in forum Excel General
    Replies: 13
    Last Post: 10-15-2012, 01:32 PM
  2. help with modifing points counting sheet
    By jp22 in forum Excel General
    Replies: 1
    Last Post: 06-10-2012, 09:47 AM
  3. Modifing SpellNumber Function
    By Pavlos1316 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-22-2011, 05:41 AM
  4. Modifing code to attach files to email
    By jat82nd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-20-2007, 01:41 PM
  5. [SOLVED] Modifing a recorded macro.
    By Duane Reynolds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2006, 12:30 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