Consulting

Results 1 to 5 of 5

Thread: Solved: Userform/sheet selection

  1. #1

    Solved: Userform/sheet selection

    Hi,

    I'm trying to get a userform to do 2 things and having trouble.

    I'm using 'with activesheet' to commit the value of a number of textboxes
    to a sheet called CMFSPLIT. I also want it to commit the value of another
    couple of textboxes to another sheet called CMFRUN.

    I want to do this for a number of paired sheets and trying the following which isn't working cos I know its wrong - but can't figure out how to fix it

    [VBA][/VBA]If ActiveSheet = Worksheets("CMFSPLIT") Then
    Worksheets("CMFRUN").Activate
    Range("c16") = TextBox85.Value: Range("E16") = TextBox86.Value
    End If[VBA][/VBA]

    Any suggestions welcome

    thanks
    Jon

  2. #2
    [VBA][/VBA]If ActiveSheet = Worksheets("CMFSPLIT") Then
    Worksheets("CMFRUN").Activate
    Range("c16") = TextBox85.Value: Range("E16") = TextBox86.Value
    End If

  3. #3
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    Without going to far into it, for me it would have to look more like this...

    [VBA]If ActiveSheet.Name = "CMFSPLIT" Then
    Worksheets("CMFRUN").Activate
    Range("C16").Value = TextBox85.Value
    Range("E16").Value = TextBox86.Value
    End If[/VBA]

    Hope this helps
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

  4. #4
    Thanks

    I had the same code but instead of .name I used .value - what a numpty

    cheers

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Why activate it?
    [VBA]
    with Worksheets("CMFRUN")
    .Range("C16").Value = TextBox85.Value
    .Range("E16").Value = TextBox86.Value
    end with
    [/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •