I have a button in 'Sheet A' that has a macro assigned to it, which adds a new row at the bottom of a series of data. The code is:


Sub SheetAa_NewRow()
Dim varUserInput As Variant
varUserInput = InputBox("Enter Row Number where you want to add a record:", _
"What Row?")
If varUserInput = "" Then Exit Sub

RowNum = varUserInput
Rows(RowNum & ":" & RowNum).Insert Shift:=xlDown
Rows(RowNum - 1 & ":" & RowNum - 1).Copy Range("A" & RowNum)
Range(RowNum & ":" & RowNum).ClearContents
End Sub

This code sits in 'Module 12'.

I have another sheet, 'Sheet B', which has a similar series of data in it. I want to add a similar button which performs the same function, using the same code. I have put the code in 'Module 17', and assigned the macro, but it keeps trying to mess with the data series in 'Sheet A.'

Could you someone explain to me why this is? I suspect I'm misunderstanding something fundamental about modules/sheets and VBA - Any advice would be a great help.

Thanks