Hi. Brand new to Macros. I have been looking at this all day trying many different ways but I cannot figure out why this wont work.
So I have a sheet that I would like to change 2 boxes in, print then change the 2 boxes, print then change the 2 boxes, etc. I have found a way to do that with a list array but I am working with large quantities and already have the data in a sheet for it to pull. One thing I have noticed is that in the "Watches" Window for some reason it is not defining the array using the range I am using and I have no idea why? I have added notes trying to determine exactly what I am trying to do and where its going wrong (comments are not the issue I promise). It will run add the first Asset Tag but no serial numbers and it loops through. Never changes the asset tag, printing each time giving me 145 of the sheets with just the first asset tag. Any direction would be greatly appreciated. Thanks! Here is the code:
- Sub PrintCopies()
- Dim myArray As Variant 'define myArray as variant allows it to be dynamic'
- myArray = Sheet1.Range("A1:B124") 'this is the array I am trying to grab. column A is Asset Tags column B is serial numbers'
- Dim i As Long 'defining i for how long the array goes (currently sitting at 145)'
- For i = LBound(myArray) To UBound(myArray) 'Using the data points as start and end no matter how long'
- Sheet2.Range("B3") = (myArray) 'taking the assest tag and printing it on the sheet (in cell B3 which i thought would then print the serial number in B4 as well)'
- ActiveSheet.PrintOut 'Print sheet'
- Next i 'go through all the A's that have data/asset tag'
- End Sub