Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Overwrite tab 1 (1 save per overwite), continous update in tab 2.

My first tab is a request form, in which case some of the info is updated in
a row on the second tab. What i want to happen is to fill out the first tab
info, and automatically the data transfers to the second tab, then save.
PROBLEM: reopen the file, overwrite the first tab, while updating the second
tab but in the next row down. I want a new row updated for each time tab is
wrote over and saved.

Thank you and have a nice day
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Overwrite tab 1 (1 save per overwite), continous update in tab 2.

You'll have to change your addresses and sheet names...

Option Explicit
Sub testme01()

Dim HistoryWks As Worksheet
Dim InputWks As Worksheet

Dim NextRow As Long
Dim oCol As Long

Dim myRng As Range
Dim myAddresses As String
Dim myCell As Range

myAddresses = "A1,F9,A2,B1"

Set InputWks = Worksheets("Input")
Set HistoryWks = Worksheets("Summary")

With InputWks
Set myRng = .Range(myAddresses)
End With

If Application.CountA(myRng) < myRng.Cells.Count Then
MsgBox "Please fill in all the cells!"
Exit Sub
End If

With HistoryWks
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
With .Cells(NextRow, "A")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
.Cells(NextRow, "B").Value = Application.UserName
oCol = 3
For Each myCell In myRng.Cells
.Cells(NextRow, oCol).Value = myCell.Value
oCol = oCol + 1
Next myCell
End With

'clean up data in form??
myRng.ClearContents

End Sub


I check to see if all the cells have something in them (maybe not required???).

I also add the date/time to column A of the summary sheet and the username
(taken from Tools|options|General tab) to column B.

Then Column C to xxxx go in the same order as the addresses you've specified in
this line:

myAddresses = "A1,F9,A2,B1"

(Change that to match your input worksheet.

(myRng.clearcontents may not be necessary, too.)


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Excel novice wrote:

My first tab is a request form, in which case some of the info is updated in
a row on the second tab. What i want to happen is to fill out the first tab
info, and automatically the data transfers to the second tab, then save.
PROBLEM: reopen the file, overwrite the first tab, while updating the second
tab but in the next row down. I want a new row updated for each time tab is
wrote over and saved.

Thank you and have a nice day


--

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 do I update a list to overwrite duplicates with new data marshall Excel Discussion (Misc queries) 0 February 21st 06 04:56 PM
options to update automatic links Werner Rohrmoser Excel Worksheet Functions 0 November 10th 05 12:58 PM
Prompt to update links Werner Rohrmoser Links and Linking in Excel 0 November 3rd 05 09:47 AM
Auto Update / Save Chewy Excel Discussion (Misc queries) 1 February 15th 05 10:09 PM
save as html writenick Excel Discussion (Misc queries) 0 January 13th 05 05:25 PM


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