Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Enter data in next empty row after cell name

I need some help entering data from a form. I have the sheet activaced and
want to select the next row after a paticular name and past information from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enter data in next empty row after cell name

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are looking for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
I need some help entering data from a form. I have the sheet activaced

and
want to select the next row after a paticular name and past information

from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Enter data in next empty row after cell name

Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are looking for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
I need some help entering data from a form. I have the sheet activaced

and
want to select the next row after a paticular name and past information

from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enter data in next empty row after cell name

That was your first mention of the word "Combobox". Assuming the combobox
is named combobox1, then

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
if len(trim(Combobox1.Value)) = 0 then exit sub
LastRow = ws.columns(1).Find(Combobox1.Value)
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

Change to suit your situation.

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are looking

for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
I need some help entering data from a form. I have the sheet

activaced
and
want to select the next row after a paticular name and past

information
from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Enter data in next empty row after cell name

Tom Thanks so much for your help, I am new at this and you don't know how
long i have been working on it. The only thing is i had to add the Set to
the LastRow..
I have been reading this discussion group and have leared a lot from
everyones wisdom. Final Code:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub


"Tom Ogilvy" wrote:

That was your first mention of the word "Combobox". Assuming the combobox
is named combobox1, then

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
if len(trim(Combobox1.Value)) = 0 then exit sub
LastRow = ws.columns(1).Find(Combobox1.Value)
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

Change to suit your situation.

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are looking

for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
I need some help entering data from a form. I have the sheet

activaced
and
want to select the next row after a paticular name and past

information
from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enter data in next empty row after cell name

Yes, it should have been set. Guess I overlooked it. My apologies.

--
Regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
Tom Thanks so much for your help, I am new at this and you don't know how
long i have been working on it. The only thing is i had to add the Set to
the LastRow..
I have been reading this discussion group and have leared a lot from
everyones wisdom. Final Code:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub


"Tom Ogilvy" wrote:

That was your first mention of the word "Combobox". Assuming the

combobox
is named combobox1, then

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
if len(trim(Combobox1.Value)) = 0 then exit sub
LastRow = ws.columns(1).Find(Combobox1.Value)
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

Change to suit your situation.

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are

looking
for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
I need some help entering data from a form. I have the sheet

activaced
and
want to select the next row after a paticular name and past

information
from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark










  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Enter data in next empty row after cell name

Tom if you are still watching this post i have another question.
I want to be able to add a blank row if there is data in the next row.
Thanks -mark

"Tom Ogilvy" wrote:

Yes, it should have been set. Guess I overlooked it. My apologies.

--
Regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
Tom Thanks so much for your help, I am new at this and you don't know how
long i have been working on it. The only thing is i had to add the Set to
the LastRow..
I have been reading this discussion group and have leared a lot from
everyones wisdom. Final Code:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub


"Tom Ogilvy" wrote:

That was your first mention of the word "Combobox". Assuming the

combobox
is named combobox1, then

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
if len(trim(Combobox1.Value)) = 0 then exit sub
LastRow = ws.columns(1).Find(Combobox1.Value)
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

Change to suit your situation.

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are

looking
for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
I need some help entering data from a form. I have the sheet
activaced
and
want to select the next row after a paticular name and past
information
from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark











  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enter data in next empty row after cell name

this command should already do that:
LastRow.Offset(1, 0).EntireRow.Insert


do you mean you don't want to insert a blank row if the next row is empty

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
if lastrow.Offset(1,0).Value < "" then _
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Tom if you are still watching this post i have another question.
I want to be able to add a blank row if there is data in the next row.
Thanks -mark

"Tom Ogilvy" wrote:

Yes, it should have been set. Guess I overlooked it. My apologies.

--
Regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
Tom Thanks so much for your help, I am new at this and you don't know

how
long i have been working on it. The only thing is i had to add the

Set to
the LastRow..
I have been reading this discussion group and have leared a lot from
everyones wisdom. Final Code:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub


"Tom Ogilvy" wrote:

That was your first mention of the word "Combobox". Assuming the

combobox
is named combobox1, then

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
if len(trim(Combobox1.Value)) = 0 then exit sub
LastRow = ws.columns(1).Find(Combobox1.Value)
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

Change to suit your situation.

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from

the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are

looking
for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in

message
...
I need some help entering data from a form. I have the sheet
activaced
and
want to select the next row after a paticular name and past
information
from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark













  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Enter data in next empty row after cell name

yes if the row is already empty i don't want to insert another one,
Thanks


"Tom Ogilvy" wrote:

this command should already do that:
LastRow.Offset(1, 0).EntireRow.Insert


do you mean you don't want to insert a blank row if the next row is empty

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
if lastrow.Offset(1,0).Value < "" then _
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Tom if you are still watching this post i have another question.
I want to be able to add a blank row if there is data in the next row.
Thanks -mark

"Tom Ogilvy" wrote:

Yes, it should have been set. Guess I overlooked it. My apologies.

--
Regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
Tom Thanks so much for your help, I am new at this and you don't know

how
long i have been working on it. The only thing is i had to add the

Set to
the LastRow..
I have been reading this discussion group and have leared a lot from
everyones wisdom. Final Code:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub


"Tom Ogilvy" wrote:

That was your first mention of the word "Combobox". Assuming the
combobox
is named combobox1, then

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
if len(trim(Combobox1.Value)) = 0 then exit sub
LastRow = ws.columns(1).Find(Combobox1.Value)
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

Change to suit your situation.

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from

the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are
looking
for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in

message
...
I need some help entering data from a form. I have the sheet
activaced
and
want to select the next row after a paticular name and past
information
from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark














  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Enter data in next empty row after cell name

Tom all is working well. You are the Man! Thanks for all your help


"Mark Cover" wrote:

yes if the row is already empty i don't want to insert another one,
Thanks


"Tom Ogilvy" wrote:

this command should already do that:
LastRow.Offset(1, 0).EntireRow.Insert


do you mean you don't want to insert a blank row if the next row is empty

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
if lastrow.Offset(1,0).Value < "" then _
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Tom if you are still watching this post i have another question.
I want to be able to add a blank row if there is data in the next row.
Thanks -mark

"Tom Ogilvy" wrote:

Yes, it should have been set. Guess I overlooked it. My apologies.

--
Regards,
Tom Ogilvy

"Mark Cover" wrote in message
...
Tom Thanks so much for your help, I am new at this and you don't know

how
long i have been working on it. The only thing is i had to add the

Set to
the LastRow..
I have been reading this discussion group and have leared a lot from
everyones wisdom. Final Code:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws As Worksheet
Set ws = ActiveSheet
If Len(Trim(cboSwitch.Value)) = 0 Then Exit Sub
Set LastRow = ws.Columns(1).Find(cboSwitch.Value)
If Not LastRow Is Nothing Then
LastRow.Offset(1, 0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End If
End Sub


"Tom Ogilvy" wrote:

That was your first mention of the word "Combobox". Assuming the
combobox
is named combobox1, then

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
if len(trim(Combobox1.Value)) = 0 then exit sub
LastRow = ws.columns(1).Find(Combobox1.Value)
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

Change to suit your situation.

--
Regards,
Tom Ogilvy


"Mark Cover" wrote in message
...
Thanks for your reply Tom:
I was wanting to fill the "name to search for" with the value from

the
ComboBox.
Thanks again for your reply
-mark

"Tom Ogilvy" wrote:

Private Sub cmdAdd_Click()
Dim LastRow As Range
Dim ws as Worksheet
Set ws = ActiveSheet
LastRow = ws.columns(1).Find("NametoSearchfor")
if not LastRow is nothing then
LastRow.offset(1,0).EntireRow.Insert
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text
End if
End Sub

change NametoSearchfor to the actual value in the cell you are
looking
for

--
regards,
Tom Ogilvy

"Mark Cover" wrote in

message
...
I need some help entering data from a form. I have the sheet
activaced
and
want to select the next row after a paticular name and past
information
from
that cell.
I hope this is clear: Here is what i have.

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim LastRow As Object
Set ws = ThisWorkbook.ActiveSheet()
Set LastRow = ws.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = txtCust.Text
LastRow.Offset(1, 1).Value = txtService.Text
LastRow.Offset(1, 2).Value = txtCircuit.Text

Thanks -mark














Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlookup if #N/A then enter enter data in cell I4 duketter Excel Discussion (Misc queries) 3 March 11th 08 09:08 PM
How to auto count data in an empty cell to be 0. Blank cell=0 Jagneel Excel Discussion (Misc queries) 5 December 13th 06 08:17 PM
Auto enter date when data in enter in another cell Brian Excel Worksheet Functions 5 December 7th 06 06:44 PM
Not allowing users to enter data into certain cells if another cell is empty KimberlyC Excel Programming 12 May 6th 05 06:19 PM
When I enter a number in an empty cel, de cel returns the value d. Paul KdN Excel Discussion (Misc queries) 2 January 13th 05 09:23 AM


All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"