Hi,

I am working on a project that requires me to develop a quite large, but not overly complicated spreadsheet. I have been asked to make the user interface as good as possible despite being a novice when it comes to the use of Macros and VBA in Excel.

Essentially my problems is as follows; When the user presses a button I want one row of the sheet he/she is in to be deleted, subsequently a number of worksheets, rows and columns are deleted so that the output sheet does not include errors. Is it a good way to write such a code that ensures that only this line is deleted and the curresponding button dissappears so that the various buttons always refers to the same row despite rows above being deleted.

Any help would be greatly appreciated

I tried to make this code using the recording function in excel and the output was as follows:

' DeleteP1 Macro
'
Rows("5:5").Select
Selection.Delete Shift:=xlUp
Sheets("Scrap").Select
Columns("B:B").Select
ActiveWindow.SmallScroll Down:=41
Selection.Delete Shift:=xlToLeft
Sheets("Defect type #1").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Sheets("Defect type #2").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Sheets("Defect type #3").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Sheets("Defect type #4").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Sheets("Defect type #5").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Sheets("Defect type #6").Select
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Calc").Select
Columns("B:B").Select
Range("B4").Activate
Selection.Delete Shift:=xlToLeft
Range("J8:P8").Select
Selection.ClearContents
Sheets("Report").Select
End Sub