ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Database operation (https://www.excelbanter.com/excel-programming/374791-database-operation.html)

Oldjay

Database operation
 
I have an input sheet that allows a user to fill in various time information
In this same sheet I have a row that has all the headings I want to to save
in a database. In the next row I have the formulas that references the input
cells

I have another sheet that I want to saves a record for each day.
It has all the above headings

Is there a macro that will copy the record to the database and have it
included in the database range?

oldjay



Ron de Bruin

Database operation
 
Maybe this page will help
http://www.rondebruin.nl/copy1.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Oldjay" wrote in message ...
I have an input sheet that allows a user to fill in various time information
In this same sheet I have a row that has all the headings I want to to save
in a database. In the next row I have the formulas that references the input
cells

I have another sheet that I want to saves a record for each day.
It has all the above headings

Is there a macro that will copy the record to the database and have it
included in the database range?

oldjay





Oldjay

Database operation
 
Thanks Helped alot

"Oldjay" wrote:

I have an input sheet that allows a user to fill in various time information
In this same sheet I have a row that has all the headings I want to to save
in a database. In the next row I have the formulas that references the input
cells

I have another sheet that I want to saves a record for each day.
It has all the above headings

Is there a macro that will copy the record to the database and have it
included in the database range?

oldjay



Oldjay

Database operation
 
I spoke too soon - Here is what I have got .I get a compile error on "Last row"
Sub or Function not defined
Ron ???

Sub copy_6_Values_PasteSpecial()

Dim destrange As Range

Range("AC151:AO151").Copy

If Selection.Areas.Count 1 Then Exit Sub

Application.ScreenUpdating = False
Set destrange = Sheets("Records").Range("PT_Data" &
LastRow(Sheets("Records")) + 1)
Selection.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub



"Oldjay" wrote:

Thanks Helped alot

"Oldjay" wrote:

I have an input sheet that allows a user to fill in various time information
In this same sheet I have a row that has all the headings I want to to save
in a database. In the next row I have the formulas that references the input
cells

I have another sheet that I want to saves a record for each day.
It has all the above headings

Is there a macro that will copy the record to the database and have it
included in the database range?

oldjay



Ron de Bruin

Database operation
 
Hi Oldjay

Copy the LastRow function from my site also in the module

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Oldjay" wrote in message ...
I spoke too soon - Here is what I have got .I get a compile error on "Last row"
Sub or Function not defined
Ron ???

Sub copy_6_Values_PasteSpecial()

Dim destrange As Range

Range("AC151:AO151").Copy

If Selection.Areas.Count 1 Then Exit Sub

Application.ScreenUpdating = False
Set destrange = Sheets("Records").Range("PT_Data" &
LastRow(Sheets("Records")) + 1)
Selection.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub



"Oldjay" wrote:

Thanks Helped alot

"Oldjay" wrote:

I have an input sheet that allows a user to fill in various time information
In this same sheet I have a row that has all the headings I want to to save
in a database. In the next row I have the formulas that references the input
cells

I have another sheet that I want to saves a record for each day.
It has all the above headings

Is there a macro that will copy the record to the database and have it
included in the database range?

oldjay





Ron de Bruin

Database operation
 
This is wrong

Set destrange = Sheets("Records").Range("PT_Data" &
LastRow(Sheets("Records")) + 1)


Use it like this to copy in the first empty row in Column A

Set destrange = Sheets("Records").Range("A" & _
LastRow(Sheets("Records")) + 1)

See
http://www.rondebruin.nl/copy1.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Oldjay" wrote in message ...
I spoke too soon - Here is what I have got .I get a compile error on "Last row"
Sub or Function not defined
Ron ???

Sub copy_6_Values_PasteSpecial()

Dim destrange As Range

Range("AC151:AO151").Copy

If Selection.Areas.Count 1 Then Exit Sub

Application.ScreenUpdating = False
Set destrange = Sheets("Records").Range("PT_Data" &
LastRow(Sheets("Records")) + 1)
Selection.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub



"Oldjay" wrote:

Thanks Helped alot

"Oldjay" wrote:

I have an input sheet that allows a user to fill in various time information
In this same sheet I have a row that has all the headings I want to to save
in a database. In the next row I have the formulas that references the input
cells

I have another sheet that I want to saves a record for each day.
It has all the above headings

Is there a macro that will copy the record to the database and have it
included in the database range?

oldjay





Oldjay

Database operation
 
Sorry to be so dumb but I can't find the LastRow function on your site

"Ron de Bruin" wrote:

This is wrong

Set destrange = Sheets("Records").Range("PT_Data" &
LastRow(Sheets("Records")) + 1)


Use it like this to copy in the first empty row in Column A

Set destrange = Sheets("Records").Range("A" & _
LastRow(Sheets("Records")) + 1)

See
http://www.rondebruin.nl/copy1.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Oldjay" wrote in message ...
I spoke too soon - Here is what I have got .I get a compile error on "Last row"
Sub or Function not defined
Ron ???

Sub copy_6_Values_PasteSpecial()

Dim destrange As Range

Range("AC151:AO151").Copy

If Selection.Areas.Count 1 Then Exit Sub

Application.ScreenUpdating = False
Set destrange = Sheets("Records").Range("PT_Data" &
LastRow(Sheets("Records")) + 1)
Selection.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub



"Oldjay" wrote:

Thanks Helped alot

"Oldjay" wrote:

I have an input sheet that allows a user to fill in various time information
In this same sheet I have a row that has all the headings I want to to save
in a database. In the next row I have the formulas that references the input
cells

I have another sheet that I want to saves a record for each day.
It has all the above headings

Is there a macro that will copy the record to the database and have it
included in the database range?

oldjay







All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com