j is the column position and the bit I need help with is in red...
I've attached the book too!!
CODE
Dim cn As Object, rs As ADODB.Recordset
Dim strMessageType As String
Dim datMessageTime As Date
Dim intMessageCount As Integer
Dim strTime As String
Dim i As Integer
Dim j As Integer
Dim ID As Integer
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= C:\db1.mdb"
Set rs = New ADODB.Recordset
rs.Open "Table1", cn, adOpenKeyset, adLockOptimistic
Sheets("sheet1").Select
Range("A1").Select
Selection.End(xlToRight).Select
j = ActiveCell.Column
[color="red"] strMessageType = Range("C1").Value[/color] The range "C1" I want to increment until 'j'
i = 1
strTime = "A1"
ID = 2
With rs
Do Until i = 3626
.AddNew
!ID = ID
!MessageType = strMessageType
!MessageTime = Range(strTime).Offset(i, 0)
!MessageCount = Range(strTime).Offset(i, 1)
.Update
i = i + 1
Loop
End With
End Sub