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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

al_b_cnu

Well-known Member
Joined
Jul 18, 2003
Messages
4,516
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
 

TWIN HYPE

Board Regular
Joined
Aug 25, 2005
Messages
82
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 :)
 

Forum statistics

Threads
1,141,628
Messages
5,707,499
Members
421,511
Latest member
mgroah1

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
Top