VBA Code:
Dim num(9) as variant
ThisWorkbook.Worksheets("Sheet1").Range("C2").Value = num()
For j = 1 To 11
For i = 0 To 9
ActiveDocument.Tables(2).Cell(1, j + 1).Range.Text = num(i)
Next i
Next j
Dim num(9) as variant
ThisWorkbook.Worksheets("Sheet1").Range("C2").Value = num()
For j = 1 To 11
For i = 0 To 9
ActiveDocument.Tables(2).Cell(1, j + 1).Range.Text = num(i)
Next i
Next j
Sub test()
Dim myVal
Dim myArray(9)
' Read the value
myVal = ActiveSheet.Range("B3").Value
' Split into the array
For i = 1 To 10
myArray(i - 1) = Mid(myVal, i, 1)
Next i
' Paste it to the columns
ActiveSheet.Range("B5:K5").Value = myArray
End Sub
Dim num(0) As Variant
num(0) = ThisWorkbook.Worksheets("Sheet1").Range("C2").Value
For i = 1 To 10
ActiveDocument.Tables(2).Cell(1, i + 1).Range.Text = Mid("", i, 1)
Next i
For j = 1 To 10
ActiveDocument.Tables(2).Cell(1, j + 1).Range.Text = Mid(num(0), j, 1)
Next j
Thank you Nate SC.Well,I should have seen this before.I was in a hurry and didnt see the notifications list.Thank you buddy.I think you are best off just using a loop to split the value up. Something along these lines:
VBA Code:Sub test() Dim myVal Dim myArray(9) ' Read the value myVal = ActiveSheet.Range("B3").Value ' Split into the array For i = 1 To 10 myArray(i - 1) = Mid(myVal, i, 1) Next i ' Paste it to the columns ActiveSheet.Range("B5:K5").Value = myArray End Sub /CODE]
first loop to clear the existing digits or alphabets and the second loop to input the digits of the cellive solved this by using mid function
VBA Code:Dim num(0) As Variant num(0) = ThisWorkbook.Worksheets("Sheet1").Range("C2").Value For i = 1 To 10 ActiveDocument.Tables(2).Cell(1, i + 1).Range.Text = Mid("", i, 1) Next i For j = 1 To 10 ActiveDocument.Tables(2).Cell(1, j + 1).Range.Text = Mid(num(0), j, 1) Next j