Hi everyone
I'm looking to fix my macro that I've created. I'm no good at actual 'programming' so I generally manually create a macro (by recording it) and then 'fix' it by changing bits of the code to suit.
I've developed an 'Interview Guide Builder', where users select or type questions that they will ask in an interview (as many or as few as they want) and then press the 'generate' button and that will generate a 'user guide'.
Here are two alternative 'processes' I want the macro to follow:
Preferred alternative
1. Unhide 'interview guide' worksheet
2. Move or copy interview guide worksheet > create copy into new workbook [may be called Book 1, book 2, book 3 etc. depending on how many spreadsheets they've opened]
3. re-hide interview guide worksheet from orginial workbook
4. In new workbook, delete range of rows where cell A? = 0
5. Save as PDF (Recruitment Interview Guide?) and save onto desktop (it will launch as a pdf)…. Will having a pdf with the same title be an issue?
6. Exit Active Workbook (ie. New book created) > Do not save changes
7.Activate PDF (Recruitment Interview Guide)
...Two documents left - original builder and pdf version of guide
Alternative if the above process won't work - this is the process I've initially attempted to record
1. Unhide 'nterview guide' worksheet
2. Move or copy interview guide worksheet > create copy into new workbook [may be called Book 1, book 2, book 3 etc. depending on how many spreadsheets they've opened]
3. re-hide interview guide worksheet from orginial workbook
4. In new workbook, delete range of rows where cell A? = 0
5. Protect Sheet (ie. No changes) in new workbook (no password required)
...Two documents left - original builder and new excel guide
At the moment I'm up to Step 4 in either of the processes, but can't find a code to suit. Where the user hasn't input a question for that section (eg. they may only choose 4/15 questions for section 1), there are "0"s in those sections. I want to delete a range of cells (I've highlighted the range that will apply each time... it is a total of 7 rows each time (4 rows above the cell, the row the cell is in and 2 rows below the cell). It would need to loop to catch all the rows as they're deleted. At the moment, it only deletes the ones I manually selected... however, the user might choose more or less questions than that..Copy of Interview Guide Builder.xlsm.
Can someone help me with this please? And if it isn't too cheeky, if anyone could assist with steps 5-7 in my first process... that would be AMAZING! 
I've attached an example of the file (please note the 'interview guide' is hidden currently) and my code that I've used is below:
Sub GenerateGuide()
'
' GenerateGuide Macro
'
'
Sheets("Interview Guide Builder").Select
Sheets("Interview Guide").Visible = True
Sheets("Interview Guide").Select
Sheets("Interview Guide").Copy
Windows("Interview Guide Builder.xlsm").Activate
Sheets("Interview Guide").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Interview Guide Builder").Select
Dim OtherFile As String
If Windows.Count <> 2 Then
MsgBox "this macro only works when 2 files are open"
End
End If
If Windows(2).Caption = ActiveWorkbook.Name Then OtherFile = Windows(1).Caption Else OtherFile = Windows(2).Caption
Windows(2).Activate
ActiveWindow.SmallScroll Down:=75
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
Rows("82:88").Select
Selection.Delete Shift:=xlUp
ActiveWindow.SmallScroll Down:=33
Rows("110:116").Select
Selection.Delete Shift:=xlUp
Rows("110:116").Select
Selection.Delete Shift:=xlUp
Rows("110:116").Select
Selection.Delete Shift:=xlUp
Rows("110:116").Select
Selection.Delete Shift:=xlUp
Rows("110:116").Select
Selection.Delete Shift:=xlUp
ActiveWindow.SmallScroll Down:=6
Rows("117:123").Select
Selection.Delete Shift:=xlUp
Rows("117:123").Select
Selection.Delete Shift:=xlUp
ActiveWindow.SmallScroll Down:=-153
Range("A1:J1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
End Sub
Thank you!!!
Bookmarks