ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,596
- Office Version
- 2007
- Platform
- Windows
Hi,
I use the code below but i see that column A is off the page.
My code searches for a value in column B
It does that fine but how do i stop column A beeing out of sight ?
Thanks
I use the code below but i see that column A is off the page.
My code searches for a value in column B
It does that fine but how do i stop column A beeing out of sight ?
Thanks
Code:
Private Sub PurchasedKey_Click()
Dim sPath As String
Dim strFileName As String
Dim sh As Worksheet
Dim wb As Workbook
With ActiveSheet
If .Range("Q1") = "" Then
MsgBox "NO CODE SHOWN TO GENERATE PDF", vbCritical, "NO CODE ON SHEET TO CREATE PDF"
Exit Sub
End If
If .Range("N1") = "M" Then
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & " (SLS).pdf"
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
Else
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & ".pdf"
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
End If
With ActiveSheet
'ActiveWindow.SelectedSheets.PrintOut copies:=1
Unload PrinterForm
.Range("B3").Select
Application.ScreenUpdating = False
Dim C As Range
Dim ans As String
Dim Lastrow As Long
ans = ActiveCell.Value
Set wb = Application.Workbooks.Open("C:\Users\Ian\Desktop\REMOTES ETC\DR\DR.xlsm")
Lastrow = Sheets("POSTAGE").Cells(Rows.Count, "B").End(xlUp).Row
For Each C In Sheets("POSTAGE").Range("B1:B" & Lastrow)
If C.Value = ans Then Application.Goto Reference:=wb.Sheets("POSTAGE").Range(C.Address): Exit For
Next
End With
End With
Application.Run ("'" & wb.Name & "'!openForm")
Application.ScreenUpdating = True
End Sub