lookup data from worksheet and overwrite with changes

Gaellus

New Member
Joined
Nov 20, 2014
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I have a big database (worksheet) of hard coded article data.
Now i would like to overwrite the data of one row when there are some changes.
So below i created an input cell which is B11. Here i put the article which I would like to change. This value looks up all the data from the database (format of database is the same as below) and shows it in A11:AH11
A9:AH9 takes over most of the data but also has formulas in it, so here i could change whatever i need, but then i need to copy this changed article row back to the database and overwrite the old.
Is that possible? Lets say the old data is in row 500 of the database.


Cell Formulas
RangeFormula
A9:I9,K9:U9A9=A11
J9J9=INDEX(FRONTPAGE!I11:M16,MATCH(NEW!F9,FRONTPAGE!H11:H16,0),MATCH(NEW!I9,FRONTPAGE!I10:M10,0))
V9V9=S9*T9*U9/1000000
W9W9=V9/R9
X9X9=W9/1000*J9
Y9Y9=H9+X9
Z9Z9=FRONTPAGE!K11
AA9AA9=FRONTPAGE!M11
AD9AD9=(((1+AA9)*Y9)/Z9)*(1+AB9)+AC9
AG9AG9=(AD9*FRONTPAGE!L11)*(1+AE9)+AF9
AH9AH9=AD9/L9
A11A11=INDEX('CP-Database'!$A:$A,MATCH(Existing!B11,'CP-Database'!$B:$B,0),0)
E11E11=VLOOKUP($B$11,'CP-Database'!$B:$AH,4,0)
G11G11=VLOOKUP($B$11,'CP-Database'!$B:$AH,6,0)
H11H11=VLOOKUP($B$11,'CP-Database'!$B:$AH,7,0)
K11K11=VLOOKUP($B$11,'CP-Database'!$B:$AH,10,0)
L11L11=VLOOKUP($B$11,'CP-Database'!$B:$AH,11,0)
M11M11=VLOOKUP($B$11,'CP-Database'!$B:$AH,12,0)
N11N11=VLOOKUP($B$11,'CP-Database'!$B:$AH,13,0)
O11O11=VLOOKUP($B$11,'CP-Database'!$B:$AH,14,0)
P11P11=VLOOKUP($B$11,'CP-Database'!$B:$AH,15,0)
Q11Q11=VLOOKUP($B$11,'CP-Database'!$B:$AH,16,0)
R11R11=VLOOKUP($B$11,'CP-Database'!$B:$AH,17,0)
S11S11=VLOOKUP($B$11,'CP-Database'!$B:$AH,18,0)
T11T11=VLOOKUP($B$11,'CP-Database'!$B:$AH,19,0)
U11U11=VLOOKUP($B$11,'CP-Database'!$B:$AH,20,0)
V11V11=VLOOKUP($B$11,'CP-Database'!$B:$AH,21,0)
W11W11=VLOOKUP($B$11,'CP-Database'!$B:$AH,22,0)
X11X11=VLOOKUP($B$11,'CP-Database'!$B:$AH,23,0)
Y11Y11=VLOOKUP($B$11,'CP-Database'!$B:$AH,24,0)
Z11Z11=VLOOKUP($B$11,'CP-Database'!$B:$AH,25,0)
AA11AA11=VLOOKUP($B$11,'CP-Database'!$B:$AH,26,0)
AB11AB11=VLOOKUP($B$11,'CP-Database'!$B:$AH,27,0)
AC11AC11=VLOOKUP($B$11,'CP-Database'!$B:$AH,28,0)
AD11AD11=VLOOKUP($B$11,'CP-Database'!$B:$AH,29,0)
AE11AE11=VLOOKUP($B$11,'CP-Database'!$B:$AH,30,0)
AF11AF11=VLOOKUP($B$11,'CP-Database'!$B:$AH,31,0)
AG11AG11=VLOOKUP($B$11,'CP-Database'!$B:$AH,32,0)
AH11AH11=VLOOKUP($B$11,'CP-Database'!$B:$AH,33,0)
Named Ranges
NameRefers ToCells
'CP-Database'!_FilterDatabase='CP-Database'!$A$5:$AH$446A11
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Is this what you want ?
Test on a COPY of your workbook

VBA Code:
Sub AmendDatabase()
    On Error Resume Next
    Dim dB  As Worksheet:   Set dB = Sheets("CP-Database")
    Dim B   As Range:       Set B = dB.Columns("B")
    Dim wX  As Worksheet:   Set wX = Sheets("Existing")
    Dim itm As Range:       Set itm = wX.Range("B9")
    Dim r   As Long:        r = WorksheetFunction.Match(itm, B, 0)
    If Err.Number = 0 Then
        dB.Range("A1:AH1").Offset(r - 1).Value = wX.Range("A9:AH9").Value
    Else
        MsgBox itm.Value & " not amended"
    End If
    On Error GoTo 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,573
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top