shieldsco
asked on
Access VBA Fill Record with Previous Value
I have a table with five fields. I would like to fill the next blank records automatically with values from the previous record. Can you help with the code. Thanks
ASKER
It's an csv import file
OOPS! I accidentally gave you Excel code ... need more information to write for Access:
1. What are the fieldnames?
2. And are you using a form to look at data (tables can't have code)
I decided to leave this in here anyway...
assuming you are in a blank row , you can run this code, which will need to be stored in another workbook, like your Personal Macro Workbook since CSV files can't have code:
1. What are the fieldnames?
2. And are you using a form to look at data (tables can't have code)
I decided to leave this in here anyway...
assuming you are in a blank row , you can run this code, which will need to be stored in another workbook, like your Personal Macro Workbook since CSV files can't have code:
Sub CopyPreviousValues_Col_AtoE()
'160902
Dim nRow As Long
nRow = ActiveCell.Row
With ActiveSheet
.Cells(nRow, 1) = .Cells(nRow - 1, 1)
.Cells(nRow, 2) = .Cells(nRow - 1, 2)
.Cells(nRow, 3) = .Cells(nRow - 1, 3)
.Cells(nRow, 4) = .Cells(nRow - 1, 4)
.Cells(nRow, 5) = .Cells(nRow - 1, 5)
End With
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
out of curiosity, why are you copying values?