unable to get the activate property of the range class

unable to get the activate property of the range class

Post by cHN3YW5pZ » Mon, 14 Jan 2008 02:36:00


im trying to

=====================================================
what code do i add to a commandbutton2 for the next?

they enter name and lastname in the textbox. when hitting commandbutton2 i
need that data from textbox1 in the next open cell sheet1 column c down. and
then command button disable. refresh either userform1 or listbox1
=====================================================


i got this code and it works
=====================================================
Option Explicit
Private Sub CommandButton1_Click()
Dim myStr As String
Dim iCtr As Long
Dim mySep As String


mySep = ", "
myStr = ""
With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
myStr = myStr & ", " & .List(iCtr)
End If
Next iCtr
End With

If myStr = "" Then
'nothing checked
Else
myStr = Mid(myStr, Len(mySep) + 1)
End If

Worksheets("inv 1st page").Range("d42").Value = myStr
Unload UserForm1
Sheets("DATA SHEET").Select
Range("A111").Select

End Sub


Private Sub UserForm_Initialize()
Dim myRng As Range
With Worksheets("inputpage")
Set myRng = .Range("c1", .Cells(.Rows.Count, "c").End(xlUp))
End With

With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption
.List = myRng.Value
End With
End Sub

=====================================================

now i want to add this and get the message popup that say

unable to get the activate property of the range class
=====================================================

Private Sub CommandButton1_Click()
Dim i As String
Dim Lrow As Variant
Lrow = Sheets("Sheet1").Range("C65536").End(xlUp).Offset(1,
0).Activate
If TextBox1.Value <> "" Then
ActiveCell.Value = TextBox1.Value
End If
CommandButton1.Enabled = False
 
 
 

unable to get the activate property of the range class

Post by Per Jesse » Mon, 14 Jan 2008 02:55:55


> ??Dim myStr As String> > ??Dim iCtr As Lo>g
> ??Dim mySep As St>in>
>
> ??mySep > ", "
> ??my>tr = ""
> ??With M>.ListBox1
> ????For iCtr = 0 To >ListCount - 1
> ??????If .Select>d(iCtr) = True Then
> ????????myStr > myStr & ", " &>.List(iCtr)
> ?gt;?????End>If> > ????Next iCtr
>>??End With
>
> ??>f myStr =>"" Then
> ????'nothing checked
> ?> Else
> ?> ?gt;?myStr = Mid(myStr, Len(mySep) + 1)
> ??End If
>
> ?gt;?Worksheets("inv 1st>page").Range("d42").Value = mySt>
> ??Unload UserForm1
>>?> Sheets("D>TA>SHEET").Select
> ????Range("A11>").Select
>
> End Sub> >
> Private Sub UserForm_Initia>ize()
> ??Dim myRng As Range
> ??With Worksheets("inputpage")> > ????Se> m>Rng = .Range("c1", .C>lls(.Rows.Count, "c").End(xlUp))
> ??>nd With
>
> ??With Me.ListBox1
>>????.MultiSelect = fmM>ltiSelectMult>
> ???> .>istStyle = fmListStyleOption
> ????.List = myRng.Va>ue> > ??End With
> End Sub
>
> ?================================>==>================
>
> ??????爊ow i want to add this and g>t the message popup that say
>
> ??????爑nable t> g>t the activate property of the range >lass
> ==========>======================>===================
>
> Private Sub CommandButton1_Click()
> >im i As String> > Dim Lrow As Variant> > ??Lro&<t; = Sheets("Sheet1").Range("C65536").En>(xlUp).Offs>t(1,
> 0).Activate
> ??If TextBox1.Value <> "" Then
> ??ActiveCell.Value = TextBox1.Value
> ??End If
> ??CommandButton1.Enabled = False

Hi


Private Sub Co>ma<dButton1_Click()
Sheets("Sheet1").Range("C65536").End(xlUp).Offset(1, 0).Activate
If TextBox1.Value <> "" Then ActiveCell.Value = Me.TextBox1.Value
Me.CommandButton1.Enabled = False
End Sub

or

Private Sub CommandButton1_Click>) <Dim Lrow As String
Lrow = Sheets("Sheet1").Range("C65536").End(xlUp).Offset(1, 0).Address
If TextBox1.Value <> "" Then Lrow.Value = Me.TextBox1.Value
Me.CommandButton1.Enabled = False
End Sub


Regards,

Per

 
 
 

unable to get the activate property of the range class

Post by cHN3YW5pZ » Mon, 14 Jan 2008 03:19:02

till cant get it to work..

how and where in my code should i put it?


"Per Jessen" wrote:

 
 
 

unable to get the activate property of the range class

Post by GTVT0 » Mon, 14 Jan 2008 03:54:41

n Jan 12, 12:19爌m, pswanie < XXXX@XXXXX.COM >
wrote:
> > > ??mySep > >,>"
> > > ??my>t> > ""
> > > ??With M>.>i>tBox1
> > > ????For iCtr = 0 To >L>s>Count - 1
> > > ??????If .Select>d>i>tr) = True Then
> > > ????????myStr > >y>tr & ", " & .Li>t>i>tr)
> > > ???gt;?gt;?gt;?End If
> >>> > > > ?Next iCtr
> > > ??gt;E>d>With
>
> > > ??If m>S>r>= "" Then> > > > ??El>e> > > > ??End If
>
> > > ?gt;?gt;W>rksheets("inv 1st pag>">.>ange("d42").Value = myStr
> > >>?gt;?gt;Unload UserForm1
> > > ??gt;Sh>e>s>"DATA SHEE>")>S>l>ct
> > > ????Range("A111").Sele>t> > > > End Sub
>
> >>>>P>ivate Sub UserForm_Initialize()
> > > ??With Worksheets("inputpage")
> > > > ???Set my>ng>=>.>ange("c1", .Cells(.Ro>s>C>unt, "c").End(xlUp))
> > > ??End With> > > > ??gt;?gt;?gt;.MultiSelect = fmMultiSele>t>u>ti
> > > ??gt;?gt;?gt;.ListStyle>= >m>i>tStyleOption
> > > ????.List = myRng.Value
> > > ?gt;?>n> >ith
> > > End Sub
>
> > > ?====================================>==>=>=>========
>
> > > ??????爊ow i want to add this and get t>e>m>ssage popup that say
>
> > > ??????爑nable to ge> t>e>a>tivate property of the range class
>>>>>>==================>=>=>======================>=>=>===
>
> > > Private Sub CommandButton1_Click()
> > > Dim i As>S>r>ng
> > > Dim >r>w>As Variant
> > > ??>row = Shee>s>">heet1"<.Range("C65536").End(xlUp).Offs>t>1>
> > > 0).>c>i>ate
> > > ??If TextBox1.Value <>>"">T>en
>>> > > ?ActiveCell.Value = TextBox1.Value >>>> > ??End If
> > > ??CommandButton1.Enabled = False
>
> > Hi
> > ??Sheets("Sheet1").Range>">65536").End(xlUp).Offset(1, 0).Activat> >> > ??If>Te>t>ox1.V>lu> >> "" Then ActiveCell.Value = Me.TextB>x>.Value
> > ??Me.Co>m>ndButton1.Enabled = False
> > End Sub
>
> > or
>
> > Private Sub Com>a>dButton1_Click()
> > Dim Lrow As String
> > Lrow = Sh<ets("S>e>t1").Range("C65536").End(xlUp).Offset(>,>0).Address> >>>>If TextBox1>Va>u> <> "" Then Lrow.Value = M>.T>xtBox1.Value
> > ??Me.CommandButton1.Enabled = False
> > End Sub
>
> > Regards,
>
> > Per- Hide quoted text -
>
> - Show quoted text -

Put this in the code for Command Button 2

Private Sub CommandButton2_Click() >Dim <row As Variant
Lrow = Sheets("Sheet1").Range("C65536").End(xlUp).Offset(1,
0).Activate
If TextBox1.Value <> "" Then
ActiveCell.Value = TextBox1.Value
End If
CommandButton2.Enabled = False
End Sub
 
 
 

unable to get the activate property of the range class

Post by cHN3YW5pZ » Mon, 14 Jan 2008 04:48:00

jip i did.. but maybe im not putting it in the right place?

i got this code and it works
 
 
 

unable to get the activate property of the range class

Post by cHN3YW5pZ » Mon, 14 Jan 2008 04:53:00

ll my efforts come back to this line and get stuck on that

Lrow = Sheets("Sheet1").Range("C65536").End(xlUp).Offset(1, 0).Activate

"GTVT06" wrote:

 
 
 

unable to get the activate property of the range class

Post by Per Jesse » Mon, 14 Jan 2008 05:05:30

n 12 Jan., 20:53, pswanie < XXXX@XXXXX.COM > wrote:
> > > > > ??With M>.>i>t>o>1
> > > > > ????For iCtr = 0 To >L>s>C>u>t - 1
> > > > > ??????If .Select>d>i>t>)>= True Then
> > > > > ????????myStr > >y>t> > ", " & .List(i>t>)> > > > > > ?gt;?> > >e>t>iCtr
> > > > > ??End>W>t> >>> > > > > > ??If myStr>=>"> >h>n
> > > > > > > > ?'nothing checked
> > > > > ??Else
> > > > > ??End If
>
> > > > > ?gt;?gt;W>r>s>eets("inv 1st page").>a>g>(>d>2").Value = myStr
> > > > > ??gt;U>l>a> >serForm1
> > > > > ??She>ts>">A>A>S>EET").Sele>t >>>>>>>>>> ????Range("A111").Select
>
>>>>>>>>>>End Sub
>
> > > > > P>i>a>e>S>b UserForm_Initialize()
> > > > > > > >i> myRng As Range
> > > > > ??With Worksheets("inputpage")
> > > > > > > > ?Set myRng > .>a>g>(>c>", .Cells(.Rows.Count> >c>)>E>d(xlUp))
> > > > > ??End With
>
> >>>>>>>>?gt;?With Me.ListBox1
> > > > > ????gt;.>u>t>S>lect = fmMultiSelectMulti >>>>>>>>>> ????.Li>t>t>l> > fmListSty>eO>t>o> >>>> > > > ????.List = myRng.Value
> > > > > ??End W>th> >
> > > > > ?========================================>==>=>=>=>=>
>
> > > > > ??????爊ow i want to add this and get the m>s>a>e>p>pup that say
>
> > > > > ??????爑nable to get th> a>t>v>t> >roperty of the range class
> > > > >>=>=>=>=>==================>=>=>=>=>==================
> >>>>>>>>>> Private Sub CommandButton1_Click()
> > > > > Dim i As String >>>>>>>>>> Dim Lrow As >a>i>n> >> > > > > ??Lrow = S>eets("Shee>1>)>R>n>e("C65536").End(xlUp<.Offset(1,
> > >>>>>>0>.>ctivate
> > > > > > ?If TextBox1.Value <> "" Then
> > >>>>>>?gt;?Act>ve>e>l>V>lue = TextBox1.Value
> > > > > ??E>d>I> >> > > > > ??CommandButton1.Enabled = False
>
> > > > Hi
>
> > >>>>P>i>ate Sub CommandButton1>Click()
> > > > ??Sheets("Sheet1").Range("<6>5>6>)>End(xlUp).Offset(1, 0).Activate
> > >>>>?gt;?gt;If TextBox>.V>l>e><> "" T>en>A>t>v>Cell.Value = Me.TextBox1.Value
> > >>>>?gt;?gt;Me.CommandButton1.Ena>l>d>=>False
> > > > End Sub
>
> > > > or
>
> > > > Private Sub CommandButt>n>_>l>ck()
> > > > Dim Lr>w As String
> > > > Lrow = Sheets("Sheet>"&g<;.>a>ge("C65536").End(xlUp).Offset(1, 0).Ad>r>s> >> > > > If>Te>t>o>1>Value <> "">Th>n>L>o>.Value = Me.TextBox1.Value> >>>>>>> ??Me.CommandButton1>En>b>ed = False
> > > > End Sub
>
> > > > Rega>ds> >>
> > > > Per- Hide quoted text -
>> >
> > Put this in the code for Command Button 2
>
> > Priva>e>Sub CommandBut>o>2_Click()
> > Dim Lro> As Varian> >> > ??Lrow = S<eets("Sheet1").Range(>C>5536").End(>l>p).Offset(1,
> > 0).Activate
> > > > If TextBox1.Value <> "" Then
> > ??Ac>iv>Cell.Value = TextBox1.Value
> > ??End If
> > ??CommandButton2.Enabled = False
> > End Sub- Skjul tekst