PDA

View Full Version : Solved: Userform/sheet selection



blackie42
01-14-2009, 05:30 AM
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

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

Any suggestions welcome

thanks
Jon

blackie42
01-14-2009, 05:31 AM
If ActiveSheet = Worksheets("CMFSPLIT") Then
Worksheets("CMFRUN").Activate
Range("c16") = TextBox85.Value: Range("E16") = TextBox86.Value
End If

georgiboy
01-14-2009, 05:52 AM
Without going to far into it, for me it would have to look more like this...

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

Hope this helps

blackie42
01-14-2009, 06:11 AM
Thanks

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

cheers

lucas
01-14-2009, 02:03 PM
Why activate it?


with Worksheets("CMFRUN")
.Range("C16").Value = TextBox85.Value
.Range("E16").Value = TextBox86.Value
end with