I've been working on what is basically a register for sales. My spreadsheet records sales, profits etc and from that prints a receipt however, I'd like to keep my own record of this data to use for graphs etc. At the moment my macro moves up from a specified column, beginning from row 100000, then when it reaches a row with data, moves down one to the empty cell. In it it places the cell reference for the new data it has found. I'm new to VBA so I'm not sure if I'm taking the right approach, this is my code:
Sub DataLog()
'
' DataLog Macro
' Record sales in the data log.
'
'
Sheets("Data").Select
Dim rngd As Range
Set rngd = Range("A100000").End(xlUp).Offset(1, 0)
Dim coke As Range
Set coke = Range("C100000").End(xlUp).Offset(1, 0)
Dim creamsoda As Range
Set creamsoda = Range("D100000").End(xlUp).Offset(1, 0)
Dim lemonade As Range
Set lemonade = Range("E100000").End(xlUp).Offset(1, 0)
Dim pasito As Range
Set pasito = Range("F100000").End(xlUp).Offset(1, 0)
Dim pepsi As Range
Set pepsi = Range("G100000").End(xlUp).Offset(1, 0)
Dim pepsim As Range
Set pepsim = Range("H100000").End(xlUp).Offset(1, 0)
Dim solo As Range
Set solo = Range("I100000").End(xlUp).Offset(1, 0)
Dim sprite As Range
Set sprite = Range("J100000").End(xlUp).Offset(1, 0)
Dim sunkist As Range
Set sunkist = Range("K100000").End(xlUp).Offset(1, 0)
Dim water As Range
Set water = Range("L100000").End(xlUp).Offset(1, 0)
rngd.Value = "=Form!D1"
coke.Value = "=Form!E7"
creamsoda.Value = "=Form!E8"
lemonade.Value = "=Form!E9"
pasito.Value = "=Form!E10"
pepsi.Value = "=Form!E11"
pepsim.Value = "=Form!E12"
solo.Value = "=Form!E13"
sprite.Value = "=Form!E14"
sunkist.Value = "=Form!E15"
water.Value = "=Form!E16"
When I clock the macro button, the first time it works, as does it the second time. Although, when it does record the second set of data in the row below, it updates all the previous data in each cell. How can I stop any previously entered data from being updated so I can keep a weekly record of information? Any help or insight is greatly appreciated, thank you :)
EDIT:
I should add, I have tried locking the cells once data has been added but this only protected them from manual alteration, the macro still updated the data.