Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

For...Next not copying text from Worksheet to Worksheet, but no Er

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RyanH - 20 May 2008 19:37 GMT
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
JLGWhiz - 20 May 2008 20:01 GMT
Hi Ryan, your items in the array are not defined, therefore myValue = Empty.

> 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
[quoted text clipped - 51 lines]
> Thanks in Advance,
> Ryan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.