Purchase Order Copy and Paste Issue
Hi, Every time run this macro to save the PO, close it, and increment the PO#
on a clear sheet the saved PO shows up blank when I open it. What am I doing wrong? Here's my code: Sub CommandButton1_Click() Dim n As Range Set n = Range("PONUM") Application.CutCopyMode = False 'clears the clipboard Range("A1:G50").Select Selection.Copy Workbooks.Add ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("A1") ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\mca.JOMA-NET\Desktop\PO" & n & ".xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False ActiveWorkbook.Close Cells(10, 2).Select 'go and park at cell B10 and wait MsgBox ("Purchase Order was saved as PO" & n & ".xls") n.Value = n.Value + 1 Range("B34:B39").ClearContents ActiveWorkbook.Save End Sub Thanks. |
Purchase Order Copy and Paste Issue
Seems to work for me. What is the actual address of Range("PONUM")?
"Jeff S." wrote: Hi, Every time run this macro to save the PO, close it, and increment the PO# on a clear sheet the saved PO shows up blank when I open it. What am I doing wrong? Here's my code: Sub CommandButton1_Click() Dim n As Range Set n = Range("PONUM") Application.CutCopyMode = False 'clears the clipboard Range("A1:G50").Select Selection.Copy Workbooks.Add ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("A1") ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\mca.JOMA-NET\Desktop\PO" & n & ".xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False ActiveWorkbook.Close Cells(10, 2).Select 'go and park at cell B10 and wait MsgBox ("Purchase Order was saved as PO" & n & ".xls") n.Value = n.Value + 1 Range("B34:B39").ClearContents ActiveWorkbook.Save End Sub Thanks. |
All times are GMT +1. The time now is 09:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com