+ Reply to Thread
Results 1 to 2 of 2

Numbers Not Updating

  1. #1
    Registered User
    Join Date
    04-25-2017
    Location
    UK
    MS-Off Ver
    2003
    Posts
    1

    Numbers Not Updating

    A Friend of mine has been helping to develop a small excel file to control our stock of letters an numbers. Everything works with taking away the letters but it does not take away the numbers, also for some reason we have to enter the letters in uppercase for it to work. I would prefer it to be able to work in upper and lower case.

    Any help really would be gratefully received.

    This is also the code that has been used so far:

    Sub Macro1()
    1. Dim RegNo As String, RegNoClean As String, RegNoLen As Integer
    2. ActiveSheet.Shapes("Rounded Rectangle 1").Select
    3. RegNo = Selection.Characters.Text
    4. RegNoClean = Replace(RegNo, " ", "")
    5. RegNoLen = Len(RegNoClean)
    6. Dim RegNoChar
    7. For i = 0 To RegNoLen
    8. RegNoChar = Left(RegNoClean, 1)
    9. Range("A2").Select
    10. rowNum = ActiveCell.Row
    11. colNum = ActiveCell.Column
    12. Set currCell = ActiveSheet.Cells(rowNum, colNum)
    13. Do While rowNum < 36
    14. If currCell.Value = RegNoChar Then
    15. currCell.Offset(0, 1).Value = currCell.Offset(0, 1).Value - 2
    16. Else
    17. End If
    18. rowNum = rowNum + 1
    19. Set currCell = ActiveSheet.Cells(rowNum, colNum)
    20. Loop
    21. RegNoClean = Mid(RegNoClean, 2)
    22. Next
    23. ActiveSheet.Shapes("Rounded Rectangle 1").Select
    24. Selection.Characters.Text = ""
    25. With Selection.Font
    26. .Name = "Calibri"
    27. .FontStyle = "Regular"
    28. .Size = 72
    29. .Strikethrough = False
    30. .Superscript = False
    31. .Subscript = False
    32. .OutlineFont = False
    33. .Shadow = False
    34. .Underline = xlUnderlineStyleNone
    35. .ColorIndex = 1
    36. End With
    37. Range("I7").Select



    End Sub
    Attached Files Attached Files
    Last edited by johnch121; 04-25-2017 at 03:05 AM. Reason: Not sure if that is correct?

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Numbers Not Updating

    Quickie to start...
    I would prefer it to be able to work in upper and lower case
    VBA is case sensitive - 'a' <> 'A'

    You can get around this by converting all strings to upper or lower case before comparing, or by adding
    Please Login or Register  to view this content.
    as the very first line in the code module.

    PS:
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

+ 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. Automatic Updating of Numbers in Formula?
    By chainhomelow in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-01-2014, 03:30 AM
  2. Ordering and Updating Numbers in a sequence
    By kglusing in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-29-2013, 10:42 AM
  3. [SOLVED] Updating Invoice Numbers on 3 Different Woorksheets
    By numbskull in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-11-2012, 12:14 PM
  4. [SOLVED] Automatically updating a list of numbers
    By khank in forum Excel General
    Replies: 4
    Last Post: 07-25-2012, 10:52 AM
  5. numbers, odering, auto-updating
    By Idaho_MT in forum Excel General
    Replies: 0
    Last Post: 02-09-2012, 03:31 PM
  6. Replies: 5
    Last Post: 03-29-2010, 06:01 AM
  7. HOW TO MAKE AUTOMATICALLY UPDATING THE NEXT PAGE NUMBERS
    By please send me the answer in forum Excel General
    Replies: 2
    Last Post: 06-23-2006, 10: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