problem on transferring data to another workbook

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: problem on transferring data to another workbook

  1. #1
    New Member
    Join Date
    Oct 2017
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default problem on transferring data to another workbook

     
    let's say here is my sample workbook ("productmovement")
    Product Out Stock Total
    apple 5 8 3
    banana 4 9 5
    orange 3 10 7

    and here is my samlple workbook ("productinventory")
    Product Stock date
    grapes 10
    apple 8
    orange 10
    avocado 5
    orange 10
    banana 9

    How can I update the remaining stock of fruits on workbook ("productinventory") based on the Total on my workbook ("productmovement")?

    sorry im just a newbie in VBA
    here is my current code

    Private Sub CommandButton1_Click()
    Dim lastrow, cell As Long

    Dim a, b As Integer
    a = 1
    lastrow = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
    Do While Cells(a, 1).Value <> ""
    Cells(a, 1).Value
    b = Cells(a, 1).Offset(0, 1).Value
    Workbooks("productinventory").Sheets("Sheet1").Range("A2:A" & lastrow).Find(What:=Cells(a, 1).Value, LookIn:=xlValues, LookAt:=xlWhole).Activate
    ' error here "run time error 438"
    cell = ActiveCell.Row
    Cells(sonsat, 2) = b
    a = a + 1
    Loop


    End Sub

  2. #2
    New Member
    Join Date
    Oct 2017
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: problem on transferring data to another workbook

      
    lastrow = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row

    instead..

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com