G
Guest
I have the following macro I wrote in Microsoft Excel VB to seperate out the
2 parts of a postcode. I want to be able to do this in an access database.
Can anyone tell me what I need to do? I have only just started using Excel VB
and have never used it in access so baby steps please.
Thanks
Sub PCodeSep()
Dim FullCode As String, First As String, Second As String, pos As Integer, i
As_ Integer
Dim number As Integer
number = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To number
FullCode = Cells(i, 1)
pos = InStr(FullCode, " ")
First = Left(FullCode, pos - 1)
Second = Mid(FullCode, pos + 1)
Cells(i, 2) = First
Cells(i, 3) = Second
Next i
End Sub
2 parts of a postcode. I want to be able to do this in an access database.
Can anyone tell me what I need to do? I have only just started using Excel VB
and have never used it in access so baby steps please.
Thanks
Sub PCodeSep()
Dim FullCode As String, First As String, Second As String, pos As Integer, i
As_ Integer
Dim number As Integer
number = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To number
FullCode = Cells(i, 1)
pos = InStr(FullCode, " ")
First = Left(FullCode, pos - 1)
Second = Mid(FullCode, pos + 1)
Cells(i, 2) = First
Cells(i, 3) = Second
Next i
End Sub