Data snapshot between worksheets.

  • Thread starter Thread starter S Cho
  • Start date Start date
S

S Cho

Hello, thanks in advance for your help!

The Problem: I would like to know how to have data from one work sheet
placed into another worksheet after pressing a "button" of some sort.

The Specifics: Worksheet A has multiple cells calculating the various
costs of an item. These costs change when I change the item. How do
I take a "snapshot" of these cells and have them display on Worksheet
B's columns, so that I can begin making a separate inventory list
detailing each item and its associated costs? Is there any way to
make a "button" that initiates the snapshot as well?

Thanks,

Steve
 
This might get you started:

Option Explicit
Option Base 0
Sub testme01()

Dim historyWks As Worksheet
Dim curWks As Worksheet
Dim destRow As Long
Dim iCtr As Long

Dim myAddresses As Variant

myAddresses = Array("A1", "B1", "D1", "F1", "H1")

Set curWks = Worksheets("WorkhseetA")
Set historyWks = Worksheets("WorksheetB")

With historyWks
destRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With

With curWks
For iCtr = LBound(myAddresses) To UBound(myAddresses)
historyWks.Cells(destRow, 1 + iCtr).Value _
= .Range(myAddresses(iCtr)).Value
.Range(myAddresses(iCtr)).ClearContents
Next iCtr
End With

End Sub

Change the worksheet names and fix the addresses on the Input sheet.
 
Thanks Dave, that did the trick!

Steve

Dave Peterson said:
This might get you started:

Option Explicit
Option Base 0
Sub testme01()

Dim historyWks As Worksheet
Dim curWks As Worksheet
Dim destRow As Long
Dim iCtr As Long

Dim myAddresses As Variant

myAddresses = Array("A1", "B1", "D1", "F1", "H1")

Set curWks = Worksheets("WorkhseetA")
Set historyWks = Worksheets("WorksheetB")

With historyWks
destRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With

With curWks
For iCtr = LBound(myAddresses) To UBound(myAddresses)
historyWks.Cells(destRow, 1 + iCtr).Value _
= .Range(myAddresses(iCtr)).Value
.Range(myAddresses(iCtr)).ClearContents
Next iCtr
End With

End Sub

Change the worksheet names and fix the addresses on the Input sheet.
 
Back
Top