I have a workbook with 2 sheets: Sheet1 and Sheet2.
In Column A of Sheet1 I have a short uninterrupted list of product IDs:
<style><!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";}@page {margin:.75in .7in .75in .7in; mso-header-margin:.3in; mso-footer-margin:.3in;}td {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignoreadding; color:black; font-size:12.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Calibri, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;}.xl63 {mso-number-format:"\@"; border-top:.5pt solid #A9D08E ; border-right:none; border-bottom:.5pt solid #A9D08E ; border-left:.5pt solid #A9D08E ; background:#E2EFDA; mso-pattern:#E2EFDA none;}.xl64 {mso-number-format:"\@"; border-top:.5pt solid #A9D08E ; border-right:none; border-bottom:.5pt solid #A9D08E ; border-left:.5pt solid #A9D08E ;}--></style>[TABLE="width: 87"]
<tbody>[TR]
[TD="class: xl63, width: 87"]26109179[/TD]
[/TR]
[TR]
[TD="class: xl64"]20346713[/TD]
[/TR]
[TR]
[TD="class: xl63"]26113399[/TD]
[/TR]
[TR]
[TD="class: xl64"]20306639[/TD]
[/TR]
[TR]
[TD="class: xl63"]26115634[/TD]
[/TR]
</tbody>[/TABLE]
I copy this list to an array with the aim of transforming it and pasting it into Sheet2. There are various things that I need to do, but the first step is to append a 4 digit code, like 6030, to the end of each element value e.g. DirArray(0) becomes 261091796030. However each time, I am get type mismatch errors. If I try to access each element in a for loop I get an out of bounds error. I am beginning to think this is not possible to do. The code below works in so far as to copy the data in Sheet1 to Sheet2 - I just need to transform the array so at the point I paste into Sheet2 they are updated values.
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 ; background-color: #ffffff }p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000080 ; background-color: #ffffff }p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; background-color: #ffffff ; min-height: 13.0px}span.s1 {color: #000080 }span.s2 {color: #000000 }</style> Dim StartCell As Range
Dim DirArray As Variant
Dim i As Integer
Sheets("Sheet1").Select
Set StartCell = Range("A1")
StartCell.CurrentRegion.Select
DirArray = StartCell.CurrentRegion.Value
Sheets("Sheet2").Select
'At this point I want to append "6030" to the END of each element value in DirArray
ActiveSheet.Range(Cells(2, 2), Cells(UBound(DirArray) + 1, 2)) = DirArray
Can anyone please help me? Thanks in anticipation.
In Column A of Sheet1 I have a short uninterrupted list of product IDs:
<style><!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";}@page {margin:.75in .7in .75in .7in; mso-header-margin:.3in; mso-footer-margin:.3in;}td {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignoreadding; color:black; font-size:12.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Calibri, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;}.xl63 {mso-number-format:"\@"; border-top:.5pt solid #A9D08E ; border-right:none; border-bottom:.5pt solid #A9D08E ; border-left:.5pt solid #A9D08E ; background:#E2EFDA; mso-pattern:#E2EFDA none;}.xl64 {mso-number-format:"\@"; border-top:.5pt solid #A9D08E ; border-right:none; border-bottom:.5pt solid #A9D08E ; border-left:.5pt solid #A9D08E ;}--></style>[TABLE="width: 87"]
<tbody>[TR]
[TD="class: xl63, width: 87"]26109179[/TD]
[/TR]
[TR]
[TD="class: xl64"]20346713[/TD]
[/TR]
[TR]
[TD="class: xl63"]26113399[/TD]
[/TR]
[TR]
[TD="class: xl64"]20306639[/TD]
[/TR]
[TR]
[TD="class: xl63"]26115634[/TD]
[/TR]
</tbody>[/TABLE]
I copy this list to an array with the aim of transforming it and pasting it into Sheet2. There are various things that I need to do, but the first step is to append a 4 digit code, like 6030, to the end of each element value e.g. DirArray(0) becomes 261091796030. However each time, I am get type mismatch errors. If I try to access each element in a for loop I get an out of bounds error. I am beginning to think this is not possible to do. The code below works in so far as to copy the data in Sheet1 to Sheet2 - I just need to transform the array so at the point I paste into Sheet2 they are updated values.
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 ; background-color: #ffffff }p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000080 ; background-color: #ffffff }p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; background-color: #ffffff ; min-height: 13.0px}span.s1 {color: #000080 }span.s2 {color: #000000 }</style> Dim StartCell As Range
Dim DirArray As Variant
Dim i As Integer
Sheets("Sheet1").Select
Set StartCell = Range("A1")
StartCell.CurrentRegion.Select
DirArray = StartCell.CurrentRegion.Value
Sheets("Sheet2").Select
'At this point I want to append "6030" to the END of each element value in DirArray
ActiveSheet.Range(Cells(2, 2), Cells(UBound(DirArray) + 1, 2)) = DirArray
Can anyone please help me? Thanks in anticipation.