Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Textbox value insert in two cells

How do modify the following code below so that the value in texbox1 will also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Textbox value insert in two cells

sheet5.range("a1").value = textbox1.text

(where sheet5 is the code name for that worksheet.)

kk wrote:

How do modify the following code below so that the value in texbox1 will also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text

--
kk


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Textbox value insert in two cells

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Textbox value insert in two cells

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk





  #5   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Textbox value insert in two cells

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk


"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk








  #6   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Textbox value insert in two cells

Sorry about that I should have made it clear at first. I was meant to say
last empty row, instead of inserting in cell A1.
sorry!!!!!
--
kk


"kk" wrote:

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk


"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk





  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Textbox value insert in two cells

The same thing as you did befo

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text

Make sure that 100 is large enough!

kk wrote:

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk

"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk






--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Textbox value insert in two cells

Thanks Dave,
For some reason it does not work!
This is part of the code I have. Any help would be great!

Option Explicit
Private Sub CommandButton1_Click()
Dim LastRow As Object
Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

If vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""

Else
End If

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text

MsgBox "Do you want to enter another record?", vbYesNo

If vbYes Then
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus

Application.EnableEvents = True

Call CommandButton99_Click

Else
End If
End Sub

--
kk


"Dave Peterson" wrote:

The same thing as you did befo

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text

Make sure that 100 is large enough!

kk wrote:

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk

"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk






--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Textbox value insert in two cells

I have no idea what your real purpose is, but maybe this does what you want:

Option Explicit
Private Sub CommandButton1_Click()

Dim LastRow As Range
Dim Resp As Long

Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text


Resp = MsgBox(Prompt:="Do you want to enter another record?", _
Buttons:=vbYesNo)

If Resp = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus
Call CommandButton99_Click

End If

Application.EnableEvents = True

End Sub

kk wrote:

Thanks Dave,
For some reason it does not work!
This is part of the code I have. Any help would be great!

Option Explicit
Private Sub CommandButton1_Click()
Dim LastRow As Object
Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

If vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""

Else
End If

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text

MsgBox "Do you want to enter another record?", vbYesNo

If vbYes Then
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus

Application.EnableEvents = True

Call CommandButton99_Click

Else
End If
End Sub

--
kk

"Dave Peterson" wrote:

The same thing as you did befo

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text

Make sure that 100 is large enough!

kk wrote:

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk

"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk






--

Dave Peterson


--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Textbox value insert in two cells

Here we go I shall try to explain it!!
I have a userform with several textboxes and comboboxes.
Textbox1 is titled �Name�.
New users enter their names in textbox1 and then fill in all the other
textboxes. The data is saved in sheets 2 in the next empty row, with the
names in column �A�.
I have run out of columns in sheet2 so I have added a new sheet (sheet5)
with the same headings as sheet2.
How do I get the name from textbox1 to load in sheet5 in the next empty row.
The same as sheet2?

--
kk


"Dave Peterson" wrote:

I have no idea what your real purpose is, but maybe this does what you want:

Option Explicit
Private Sub CommandButton1_Click()

Dim LastRow As Range
Dim Resp As Long

Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text


Resp = MsgBox(Prompt:="Do you want to enter another record?", _
Buttons:=vbYesNo)

If Resp = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus
Call CommandButton99_Click

End If

Application.EnableEvents = True

End Sub

kk wrote:

Thanks Dave,
For some reason it does not work!
This is part of the code I have. Any help would be great!

Option Explicit
Private Sub CommandButton1_Click()
Dim LastRow As Object
Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

If vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""

Else
End If

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text

MsgBox "Do you want to enter another record?", vbYesNo

If vbYes Then
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus

Application.EnableEvents = True

Call CommandButton99_Click

Else
End If
End Sub

--
kk

"Dave Peterson" wrote:

The same thing as you did befo

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text

Make sure that 100 is large enough!

kk wrote:

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk

"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk






--

Dave Peterson


--

Dave Peterson



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Textbox value insert in two cells

Why did your code use textbox3 and textbox4?

Change them to what you want.

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text



kk wrote:

Here we go I shall try to explain it!!
I have a userform with several textboxes and comboboxes.
Textbox1 is titled �Name�.
New users enter their names in textbox1 and then fill in all the other
textboxes. The data is saved in sheets 2 in the next empty row, with the
names in column �A�.
I have run out of columns in sheet2 so I have added a new sheet (sheet5)
with the same headings as sheet2.
How do I get the name from textbox1 to load in sheet5 in the next empty row.
The same as sheet2?

--
kk

"Dave Peterson" wrote:

I have no idea what your real purpose is, but maybe this does what you want:

Option Explicit
Private Sub CommandButton1_Click()

Dim LastRow As Range
Dim Resp As Long

Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text


Resp = MsgBox(Prompt:="Do you want to enter another record?", _
Buttons:=vbYesNo)

If Resp = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus
Call CommandButton99_Click

End If

Application.EnableEvents = True

End Sub

kk wrote:

Thanks Dave,
For some reason it does not work!
This is part of the code I have. Any help would be great!

Option Explicit
Private Sub CommandButton1_Click()
Dim LastRow As Object
Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

If vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""

Else
End If

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text

MsgBox "Do you want to enter another record?", vbYesNo

If vbYes Then
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus

Application.EnableEvents = True

Call CommandButton99_Click

Else
End If
End Sub

--
kk

"Dave Peterson" wrote:

The same thing as you did befo

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text

Make sure that 100 is large enough!

kk wrote:

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk

"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk






--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #12   Report Post  
Posted to microsoft.public.excel.misc
KK KK is offline
external usenet poster
 
Posts: 61
Default Textbox value insert in two cells

I have manage to sort it now.

On my earlier post, I had the following code:

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

If vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""

Else
End If

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text

MsgBox "Do you want to enter another record?", vbYesNo

If vbYes Then
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""


I had inserted
TextBox1.Text = ""
In the wrong place. It should have gone after the message box. In effect I
was clearing textbox1 before the data was entered in sheet5.

It all works fine now.

--
kk


"kk" wrote:

Here we go I shall try to explain it!!
I have a userform with several textboxes and comboboxes.
Textbox1 is titled �Name�.
New users enter their names in textbox1 and then fill in all the other
textboxes. The data is saved in sheets 2 in the next empty row, with the
names in column �A�.
I have run out of columns in sheet2 so I have added a new sheet (sheet5)
with the same headings as sheet2.
How do I get the name from textbox1 to load in sheet5 in the next empty row.
The same as sheet2?

--
kk


"Dave Peterson" wrote:

I have no idea what your real purpose is, but maybe this does what you want:

Option Explicit
Private Sub CommandButton1_Click()

Dim LastRow As Range
Dim Resp As Long

Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text


Resp = MsgBox(Prompt:="Do you want to enter another record?", _
Buttons:=vbYesNo)

If Resp = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus
Call CommandButton99_Click

End If

Application.EnableEvents = True

End Sub

kk wrote:

Thanks Dave,
For some reason it does not work!
This is part of the code I have. Any help would be great!

Option Explicit
Private Sub CommandButton1_Click()
Dim LastRow As Object
Application.EnableEvents = False

Set LastRow = Sheet2.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text

If vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""

Else
End If

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox3.Text
LastRow.Offset(1, 1).Value = TextBox4.Text

MsgBox "Do you want to enter another record?", vbYesNo

If vbYes Then
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""

TextBox1.SetFocus

Application.EnableEvents = True

Call CommandButton99_Click

Else
End If
End Sub

--
kk

"Dave Peterson" wrote:

The same thing as you did befo

Set LastRow = Sheet5.Range("a100").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text

Make sure that 100 is large enough!

kk wrote:

Thanks guys
But I need sheet5 to be the same as sheet2.
In other words it looks for the last empty row both on sheet2 and sheet5 and
inserts textbox1 value.

--
kk

"Bob Phillips" wrote:

No idea what happened to my typing, it should be

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Worksheets("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text
Wrksheeys("Sheet5").Range("A1").Value = TextBox1.Text


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"kk" wrote in message
...
How do modify the following code below so that the value in texbox1 will
also
be inserted in sheet5 cell "A1"

Set LastRow = Sheet2.Range("a100").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox1.Text


--
kk






--

Dave Peterson


--

Dave Peterson

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
Automaticaly update a textbox from filtered cells Panos Excel Discussion (Misc queries) 0 October 2nd 07 12:12 PM
Control Toolbox Textbox and Linked Cells Carol Sitea Excel Discussion (Misc queries) 2 March 14th 07 03:14 PM
Can't insert cells kramer31 Excel Discussion (Misc queries) 2 March 6th 07 10:59 PM
Insert copied cells Martin B Excel Worksheet Functions 3 August 30th 06 10:47 PM
Insert spreadsheet in Excel textbox or comment box w1morecast Excel Discussion (Misc queries) 0 October 18th 05 06:51 PM


All times are GMT +1. The time now is 03:01 PM.

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

About Us

"It's about Microsoft Excel"