Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking up a variable in one worksheet and copying information from another column to another worksheet?? Brad Torken Excel Discussion (Misc queries) 2 December 10th 06 06:02 AM
Copying a worksheet witrh protected cells to a new worksheet John Excel Worksheet Functions 2 February 1st 06 02:19 PM
Copying Text to another cell/worksheet Lisa Excel Worksheet Functions 3 April 12th 05 07:00 AM
Copying text file into worksheet No Name Excel Programming 1 October 11th 04 04:56 AM
Copying Worksheet triggers Click event of combobox on another worksheet Robert[_20_] Excel Programming 0 January 23rd 04 07:40 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"