I'm stumped!!

TWIN HYPE

Board Regular
Joined
Aug 25, 2005
Messages
82
Hi All,

I have the following problem:

I have a worksheet which is a summary of risks of which the risk id numbers are all unique. I also have a ‘Risk Edit’ worksheet that uses a data validation cell to select the risk id number and then the line ‘=INDEX('Risk Summary'!F:F,MATCH($B$5,'Risk Summary'!$D:$D,0))’ to match all of the other information cells to that number. This then fills in the form with all the information you may want to change.

I wish to write some VBA that I can assign to a button/shape that copies the new information that will be typed over the above formula and will look at the risk id number and copy it back to correct place on the ‘Risk Summary’ worksheet.

Can any of you help me out with this?

Many Thanks

Twin


Excel 2002
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi,

Not too sure of the worksheet layouts, but this worksheet change event copies any changes to cells in Risk Edit, columns D onwards to the appropriate cell in Risk Summary.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range
Dim vRow As Long
Dim WS As Worksheet

Set WS = Sheets("Risk Summary")
On Error Resume Next
vRow = "*"
vRow = WorksheetFunction.Match(Range("B5"), WS.Columns("D"), 0)
On Error GoTo 0

For Each R In Target
    If R.Column > 4 Then
        If Val(vRow) = 0 Then
            MsgBox "Risk ID number " & Range("B5").Value & " not found."
            Exit Sub
        End If
        WS.Cells(vRow, R.Column).Value = R.Value
    End If
Next R
End Sub
 
Upvote 0
Hey Alan,

Thanks for that, I haven't checked it out yet as I have been slammed with some major reporting but I'll get back to you when I've tried it out.

Thanks again :)
 
Upvote 0

Forum statistics

Threads
1,218,746
Messages
6,144,264
Members
450,533
Latest member
xoxo1998

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