How ???


Posted by Marc on May 03, 2001 3:13 PM

Hello everyone


This is what I want to accomplish,I want to add data to a cell using my
Userform in range example {:A1,A3,A5,A7,A9,A11 and B1,B3,B5,B7,B9,B11} and so on.
Here is the thing, if data is already entered in a cell I want excel to go the next available cell
That I listed above.

Example: there is data in cell A1 then choose A3 if data in cell A3 then go to cell A5 and so on.

Very simple,right ! NOT

Thanks

Regards
Marc

Posted by Dave Hawley on May 03, 2001 4:00 PM


Hi Marc

Using your A1, A3, A5 etc example you could use:


Private Sub CommandButton1_Click()
Dim i As Integer

For i = 1 To 11 Step 2
If Cells(i, 1) = "" Then
Cells(i, 1) = TextBox1.Value
Exit For
End If
Next i

End Sub


Dave


OzGrid Business Applications

Posted by Mark Philpot on May 03, 2001 4:13 PM

Posted by Mark Philpot on May 03, 2001 4:20 PM


I use unconventional, or rather conventional, methods. This is how I would do it.

Sub marc()
Range("A1").select
home:
set b=selection
if b<>"" then goto nex1 else goto fillit
nex1:
activecell.offset(2,0).select
goto home
fillit:
b.formula="Hello, My name is mark"
if b="" then exit sub
goto home
End Sub

Posted by Marc on May 03, 2001 5:16 PM


Ok thanks, I am almost there but let’s say the data goes in cell
E1,E3,E5,E7,E9,E11 AND E100,E103,E105,E107,E109
And there is data between the above field that I want to skip,
What then?

Again I really appreciate all the help I get!

Thank you

Marc



Posted by Dave Hawley on May 03, 2001 6:18 PM

Hi Marc

this shouldn't pose to much of a problem, try this:


Private Sub CommandButton1_Click()
Dim i As Integer

For i = 1 To 109 Step 2
If Cells(i, 5) = "" Then
Cells(i, 5) = TextBox1.Value
End If
If i >= 11 Then i = 100
Next i
End Sub

Dave
OzGrid Business Applications