![]() |
For...Next not copying text from Worksheet to Worksheet, but no Er
I have a command button on my UserForm that calculates the values for
FacePlastic_Row, HangRail_Row, and TrimCap_Row. These values represent a Row Number where my Part Descriptions are. If the part is not used it = 0. I want the For...Next loop to copy the Parts Description to the Worksheet("BOM & Labor"). The problem is when I click the button nothing happens and no errors. Anybody have any ideas? The Array(FacePlastic_Qty, HangRail_Qty, TrimCap_Qty) represents the quantities of the part that is used. It doesn't copy the Quantity to Sheets("BOM & Labor") either and no errors? Any ideas? Private Sub cmbBOM_Click() Dim LastRow As Double Dim myValue As Variant Dim myQty As Variant Dim myBOM_Des As Variant Dim myBOM_Qty As Variant Sheets("BOM & Labor").Unprotect "AdTech" LastRow = Sheets("BOM & Labor").Range("A5").Row 'array of row address where the part description is located in "Parts List" myBOM_Des = Array(FacePlastic_Row, HangRail_Row, TrimCap_Row) 'adds part descriptions from "Parts List" to "BOM & Labor" For Each myValue In myBOM_Des LastRow = LastRow + 1 If myValue < 0 Then Sheets("BOM & Labor").Range("A" & LastRow & ":D" & LastRow) = Sheets("Parts List").Range("A" & myValue & ":D" & myValue) End If Next myValue LastRow = Sheets("BOM & Labor").Range("A5").Row 'array of required part quantities myBOM_Qty = Array(FacePlastic_Qty, HangRail_Qty, TrimCap_Qty) 'adds part quantities next to the description For Each myQty In myBOM_Qty LastRow = LastRow + 1 If myQty < 0 Then Sheets("BOM & Labor").Range("E" & LastRow) = myQty End If Next myQty Sheets("BOM & Labor").Protect "AdTech" End Sub Thanks in Advance, Ryan |
For...Next not copying text from Worksheet to Worksheet, but no Er
Hi Ryan, your items in the array are not defined, therefore myValue = Empty.
"RyanH" wrote: I have a command button on my UserForm that calculates the values for FacePlastic_Row, HangRail_Row, and TrimCap_Row. These values represent a Row Number where my Part Descriptions are. If the part is not used it = 0. I want the For...Next loop to copy the Parts Description to the Worksheet("BOM & Labor"). The problem is when I click the button nothing happens and no errors. Anybody have any ideas? The Array(FacePlastic_Qty, HangRail_Qty, TrimCap_Qty) represents the quantities of the part that is used. It doesn't copy the Quantity to Sheets("BOM & Labor") either and no errors? Any ideas? Private Sub cmbBOM_Click() Dim LastRow As Double Dim myValue As Variant Dim myQty As Variant Dim myBOM_Des As Variant Dim myBOM_Qty As Variant Sheets("BOM & Labor").Unprotect "AdTech" LastRow = Sheets("BOM & Labor").Range("A5").Row 'array of row address where the part description is located in "Parts List" myBOM_Des = Array(FacePlastic_Row, HangRail_Row, TrimCap_Row) 'adds part descriptions from "Parts List" to "BOM & Labor" For Each myValue In myBOM_Des LastRow = LastRow + 1 If myValue < 0 Then Sheets("BOM & Labor").Range("A" & LastRow & ":D" & LastRow) = Sheets("Parts List").Range("A" & myValue & ":D" & myValue) End If Next myValue LastRow = Sheets("BOM & Labor").Range("A5").Row 'array of required part quantities myBOM_Qty = Array(FacePlastic_Qty, HangRail_Qty, TrimCap_Qty) 'adds part quantities next to the description For Each myQty In myBOM_Qty LastRow = LastRow + 1 If myQty < 0 Then Sheets("BOM & Labor").Range("E" & LastRow) = myQty End If Next myQty Sheets("BOM & Labor").Protect "AdTech" End Sub Thanks in Advance, Ryan |
All times are GMT +1. The time now is 02:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com