Macros deleting certain worksheets, columns and rows


S

Steezo

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 th
user interface as good as possible despite being a novice when it come
to the use of Macros and VBA in Excel.

Essentially my problems is as follows; When the user presses a button
want one row of the sheet he/she is in to be deleted, subsequently
number of worksheets, rows and columns are deleted so that the outpu
sheet does not include errors. Is it a good way to write such a cod
that ensures that only this line is deleted and the currespondin
button dissappears so that the various buttons always refers to th
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 th
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 Su
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top