I have 2 workbooks. One is a Work Order that I have programmed several user forms to populate different sheets. This document is set up using named ranges to make my coding easier for people to understand in my company. The second is a Custom Panel Log (Database in excel) that we use to track what project was assigned this years serial numbers (it is password protected on opening).
What I need ot do is find a way to use a Button on the Work Order Activation Sheet to
1. Open the Custom Panel Log using the password
2. Find the next empty row starting in column B (Column A has the predefined serial numbers)
3. Start a Loop using the Qty field (Named Range) in the General Info Sheet of the Work Order to fill in the following ranges into the correct columns in the Custom Panel Log
A. Custom Panel Log.xls.Sheets("2012").Cells(nextemptyrow, "D").Value = Work Order.Sheets("General Info").Range("JOB").Value
B. (nextemptyrow, "E").Value = Range("Customer").Value
C. (nextemptyrow, "F").Value = Range("Lot").Value
D. (nextemptyrow, "G").Value = Range("CustomerPO").Value
E. (nextemptyrow, "H").Value = Range("PartNo").Value
If the Value in the Work Order Qty field is 30, I need the process to loop and fill the next 30 empty rows in the custom panel log then save the file and close.
I have the following code that i have tried to setup and find the next empty row bt it is not working. It will run with no errors but will not transfer any data to the custom panel log. I do not know how to make it loop with the value of the qty field or if this code is even correct. I am doing something similar to this where my database has a button and fills my form in a different workbook, i tried tomodify the code for that to get this.
I can send copies of these files to anyone who would like to help me out. If i can get this done for this process i will be able to automate several other process that we spend about 7-15 hours a week doing. (Note i am using Excel 07 but saving my files still as 2000-2003 as many of the users in the company have not been upgraded to newer versions of Office)
What I need ot do is find a way to use a Button on the Work Order Activation Sheet to
1. Open the Custom Panel Log using the password
2. Find the next empty row starting in column B (Column A has the predefined serial numbers)
3. Start a Loop using the Qty field (Named Range) in the General Info Sheet of the Work Order to fill in the following ranges into the correct columns in the Custom Panel Log
A. Custom Panel Log.xls.Sheets("2012").Cells(nextemptyrow, "D").Value = Work Order.Sheets("General Info").Range("JOB").Value
B. (nextemptyrow, "E").Value = Range("Customer").Value
C. (nextemptyrow, "F").Value = Range("Lot").Value
D. (nextemptyrow, "G").Value = Range("CustomerPO").Value
E. (nextemptyrow, "H").Value = Range("PartNo").Value
If the Value in the Work Order Qty field is 30, I need the process to loop and fill the next 30 empty rows in the custom panel log then save the file and close.
I have the following code that i have tried to setup and find the next empty row bt it is not working. It will run with no errors but will not transfer any data to the custom panel log. I do not know how to make it loop with the value of the qty field or if this code is even correct. I am doing something similar to this where my database has a button and fills my form in a different workbook, i tried tomodify the code for that to get this.
Code:
Private Sub AssignPanelNocmnd_Click()
Dim xNewApp As New Excel.Application
Dim xNewWB As New Excel.Workbook
Dim strFile As String
Dim RowCount As Long
Dim Ws1 As Worksheet, Ws2 As Worksheet
'***You must change the file path and extension below as applicable***
strFile = "C:\Documents and Settings\JTraylor\Desktop\Forms for DST By Jimmie\Copy of Custom Panel Log Test.xls"
Set xNewWB = xNewApp.Workbooks.Open(strFile)
Set Ws1 = ThisWorkbook.Sheets("General Info")
Set Ws2 = xNewApp.Sheets("2012")
Ws2.Activate
Ws2.Range("B1").Activate
RowCount = Ws2.Range("B1").CurrentRegion.Rows.Count
With Ws2.Range("B1")
.Offset(RowCount, 2) = Ws1.Range("JOB").Value
.Offset(RowCount, 3) = Ws1.Range("Customer").Value
.Offset(RowCount, 4) = Ws1.Range("Lot").Value
.Offset(RowCount, 5) = Ws1.Range("CustomerPO").Value
.Offset(RowCount, 6) = Ws1.Range("PartNo").Value
End With
xNewWB.Save
xNewWB.Close
Set xNewWB = Nothing
Set xNewApp = Nothing
End Sub
I can send copies of these files to anyone who would like to help me out. If i can get this done for this process i will be able to automate several other process that we spend about 7-15 hours a week doing. (Note i am using Excel 07 but saving my files still as 2000-2003 as many of the users in the company have not been upgraded to newer versions of Office)