Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert Record

Sir i want to insert record one sheet cells into another sheets cells through
command button. after saving data second data will save on next row
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Insert Record

Try this with Command Button on Sheet1:

Private Sub CommandButton1_Click()
Dim LRow As Long
Dim MyCell As String

LRow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row
If IsEmpty(Sheet2.Cells(LRow, 1)) Then
LRow = LRow
Else
LRow = LRow + 1
End If
MyCell = ActiveCell.Address
Sheet2.Cells(LRow, 1).Value = ActiveCell.Value
Sheet1.Range(MyCell).Activate

End Sub

Mike F
"Sohail khan" <Sohail wrote in message
...
Sir i want to insert record one sheet cells into another sheets cells
through
command button. after saving data second data will save on next row



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Insert Record

Mr Mike this code is not applied. I send you example

In Sheet1 there are 3 fields
A1: Invoice#
B1 DATE
C1: Qty
when I input in sheet 1 such as Invoice#: 1245, DATE: 18-1-2010, QTY:12.
Then i want these input fielsd will save in sheet2 serial wise when i click
on save button.Kindly Give me code regarding these fields



"Mike Fogleman" wrote:

Try this with Command Button on Sheet1:

Private Sub CommandButton1_Click()
Dim LRow As Long
Dim MyCell As String

LRow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row
If IsEmpty(Sheet2.Cells(LRow, 1)) Then
LRow = LRow
Else
LRow = LRow + 1
End If
MyCell = ActiveCell.Address
Sheet2.Cells(LRow, 1).Value = ActiveCell.Value
Sheet1.Range(MyCell).Activate

End Sub

Mike F
"Sohail khan" <Sohail wrote in message
...
Sir i want to insert record one sheet cells into another sheets cells
through
command button. after saving data second data will save on next row



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Insert Record

Assuming both sheets have headers in row 1, this will transfer data from the
last used row, columns A:C of Sheet1 to the next empty row, columns A:C of
sheet2.

Private Sub CommandButton1_Click()
Dim LRow As Long
Dim Src As Range, Dest As Range

LRow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row
If IsEmpty(Sheet2.Cells(LRow, 1)) Then
LRow = LRow
Else
LRow = LRow + 1
End If
Set Dest = Sheet2.Range("A" & LRow & ":C" & LRow)
LRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
Set Src = Sheet1.Range("A" & LRow & ":C" & LRow)
Dest.Value = Src.Value
End Sub

Mike F

"sohail" wrote in message
...
Mr Mike this code is not applied. I send you example

In Sheet1 there are 3 fields
A1: Invoice#
B1 DATE
C1: Qty
when I input in sheet 1 such as Invoice#: 1245, DATE: 18-1-2010, QTY:12.
Then i want these input fielsd will save in sheet2 serial wise when i
click
on save button.Kindly Give me code regarding these fields



"Mike Fogleman" wrote:

Try this with Command Button on Sheet1:

Private Sub CommandButton1_Click()
Dim LRow As Long
Dim MyCell As String

LRow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row
If IsEmpty(Sheet2.Cells(LRow, 1)) Then
LRow = LRow
Else
LRow = LRow + 1
End If
MyCell = ActiveCell.Address
Sheet2.Cells(LRow, 1).Value = ActiveCell.Value
Sheet1.Range(MyCell).Activate

End Sub

Mike F
"Sohail khan" <Sohail wrote in message
...
Sir i want to insert record one sheet cells into another sheets cells
through
command button. after saving data second data will save on next row



.



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
Insert data into SQL Server db - find out the record number D. Leger Excel Programming 6 November 29th 08 09:36 AM
Issue w/ AutoNumber Field during DAO Record Insert MSweetG222 Excel Programming 1 February 25th 06 07:13 PM
automatically insert 8 blank rows between each record Evad Excel Discussion (Misc queries) 1 February 2nd 06 04:35 AM
How do I get it to insert addresses instead of Next Record? grace Excel Worksheet Functions 0 September 14th 05 08:22 AM
Insert record into Excel database using a custom VBA form? [email protected] Excel Programming 3 July 31st 05 03:54 AM


All times are GMT +1. The time now is 11:52 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"