Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default New rows overwriting existing problem

Hello,

I have set up a little workbook that has three sheets in it.

Sheet 1:
is a suedo user form that the user enters data into formatted cells on the
sheet. each cell that a user enters data into is named

Sheet 2: Temp Table
This sheet is a database sheet that has columns that correspond to each cell
on the sheet 1. The data for this table comes from the user entering it into
sheet 1

Sheet 3: Site Reading Log
This sheet is the master log.

The idea is that users would enter values into the 'form' on sheet one.
Sheet 2 stores those values in a single row. Once the user clicks 'Submit'
on SHeet 1, the code is suppsoed to copy the row from sheet 2, into the next
available row in sheet three.

now, this code below does this, but there is a problem. If i try to enter a
new set of data, when i click submit, the code overwrites the data stored in
the previous rows with the new data pasted. What i end up wiht is multiple
rows, containing the same data.

What i actually want is a list of all my data, each in its own row.

Can any one help me with thsi problem?

Code ------
Private Sub CmdSubmit_Click()
Dim iRow As Long
Dim ws As Worksheet

Set ws = Worksheets("Site Reading Log")

' find first empty row in database

iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

Worksheets("TempTable").Range("DailyReadingEntry") .Copy ws.Cells(iRow, 1)

End Sub
--
Carlee
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default New rows overwriting existing problem

See your other thread.

You may want to make sure that all the data in DailyReadingEntry is filled
in--then you don't have to worry about empty cells causing trouble:

with Worksheets("TempTable").Range("DailyReadingEntry")
if .counta(.cells) = .count then
'all the cells are filled in
else
msgbox "Please fill in all the cells!
exit sub
end if
end with

'code to copy would go here.

=================
ps.

Debra Dalgleish has a similar worksheet "form" that does something close to what
you're doing he
http://www.contextures.com/xlForm02.html

And she has another related procedure here (to print items from the database):
http://www.contextures.com/xlForm03.html

Carlee wrote:

Hello,

I have set up a little workbook that has three sheets in it.

Sheet 1:
is a suedo user form that the user enters data into formatted cells on the
sheet. each cell that a user enters data into is named

Sheet 2: Temp Table
This sheet is a database sheet that has columns that correspond to each cell
on the sheet 1. The data for this table comes from the user entering it into
sheet 1

Sheet 3: Site Reading Log
This sheet is the master log.

The idea is that users would enter values into the 'form' on sheet one.
Sheet 2 stores those values in a single row. Once the user clicks 'Submit'
on SHeet 1, the code is suppsoed to copy the row from sheet 2, into the next
available row in sheet three.

now, this code below does this, but there is a problem. If i try to enter a
new set of data, when i click submit, the code overwrites the data stored in
the previous rows with the new data pasted. What i end up wiht is multiple
rows, containing the same data.

What i actually want is a list of all my data, each in its own row.

Can any one help me with thsi problem?

Code ------
Private Sub CmdSubmit_Click()
Dim iRow As Long
Dim ws As Worksheet

Set ws = Worksheets("Site Reading Log")

' find first empty row in database

iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

Worksheets("TempTable").Range("DailyReadingEntry") .Copy ws.Cells(iRow, 1)

End Sub
--
Carlee


--

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
How to add data into a text file without overwriting existing data J@Y Excel Programming 2 June 28th 07 03:10 PM
Overwriting an existing Excel workbook Jenni Excel Discussion (Misc queries) 6 January 5th 07 06:32 PM
Overwriting existing data in an Excel worksheet using ADO.Net Joel Gordon Excel Programming 6 December 2nd 04 08:34 AM
Overwriting existing data in an Excel worksheet using ADO.Net Joel Gordon Excel Programming 3 December 1st 04 08:43 AM
Overwriting an existing workbook without having to click yes in the prompt box Ian M[_2_] Excel Programming 2 May 3rd 04 03:41 AM


All times are GMT +1. The time now is 12:07 AM.

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"