+ Reply to Thread
Results 1 to 2 of 2

How do I specify which Labels I want to change?

Hybrid View

  1. #1
    Registered User
    Join Date
    09-19-2021
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    15

    How do I specify which Labels I want to change?

    I'm trying to make Labels 27-33 read L36:L42 when I click the Assign button but somehow my other labels get changed and I'm not sure how to fix this.
    Here is my userform, left is before I click Assign and right is after. Thank you!
    photo1632445539 (1).jpeg
    and here is my code, cmbassign is the Assign command button
    Private Sub cmbassign_Click()
    Call chgassign
    End Sub
    
    Sub chgassign()
    i = 1
    Set rg = Range("L36")
    Set rg = Range("L37")
    Set rg = Range("L38")
    Set rg = Range("L39")
    Set rg = Range("L40")
    Set rg = Range("L41")
    Set rg = Range("L42")
    For Each ctrl In Me.Controls
    If TypeName(ctrl) = "Label" And ctrl.Name = "Label3" & CStr(i - 1) Then
    ctrl.Caption = rg(i).Value
    i = i + 1
    End If
    Next
    End Sub
    Last edited by shuxin; 09-23-2021 at 10:38 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,707

    Re: How do I specify which Labels I want to change?

    You have marked this as solved - if it is, please share the solution.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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. [SOLVED] Can't change x-axis labels
    By getravel in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-15-2019, 05:51 PM
  2. Change chart/pivot table numeric labels to associated text labels
    By petschek in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-07-2014, 05:32 PM
  3. change x axis labels
    By random379 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2013, 11:30 PM
  4. change all data labels
    By spinkung in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 11-01-2009, 11:36 AM
  5. [SOLVED] change the column labels from A to Name
    By Confused Deputy in forum Excel General
    Replies: 2
    Last Post: 10-07-2005, 01:05 PM
  6. [SOLVED] How do I Change column labels to ABC from 123 ?
    By Jeff in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-14-2005, 10:07 AM
  7. how do i change a spreadsheet into labels?
    By saveusonthemisssissippi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-01-2005, 06:06 PM

Tags for this Thread

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