P
Ped_Esc
Hi
Im having problems with this macro (above), only works until date 09/07/2004, from 10 to 31 doesn't work. Please Help me!!
Sub Macro1()
Workbooks.Open Filename:="C:\TEMP\faxdata.DBF"
'the structure of that table is like this: fdata (date),hampm (char2, values AM and PM only), then 10 fields with values all integer'
Windows("C2004.xls").Activate
Dim rng As Range
Set rng = Sheets("07").Range("B7:B80")
'at B7 begins my dates from 01/07/04 until 31/07/04
For Each Cell In rng
If Cell <> "" Then 'explanation above at (1) mark
Data = Cell ' here I keep my Date
OPE = IIf(Cell.Offset(0, 1).Value = "a", "AM", "PM")
'I change a/p to AM/PM 'cause in faxdata the value is like that
Windows("faxdata.dbf").Activate
With Worksheets("faxdata").Range("A1:A1000")
Set c = .Find(Data, LookIn:=xlValues) 'I found this example and I take it
'but Idk how exactly means "LookIn:=xlValues"??
If Not c Is Nothing Then
'I guess this means If c has a value or not, right?
If OPE = "AM" Then
adrow = 0
Else
adrow = 18
End If
Cell.Offset(0, 2).Value = Cells(c.Row + adrow, 11)
Cell.Offset(0, 3).Value = Cells(c.Row + adrow + 1, 11)
Cell.Offset(0, 4).Value = Cells(c.Row + adrow + 2, 11)
Cell.Offset(0, 7).Value = Cells(c.Row + adrow + 12, 11)
'at C2004.xls I replace the values i need it
End If
End With
End If
Windows("C2004.xls").Activate
Next
End Sub
'(1) ----> here I want to select the value of the next column , for example if the cursor is positioning at B7 with value "03/07/2004" I would like to obtaint C7 value (only "AM" and "PM" is saved in this cells), then with this 2 values I need to look into a .DBF file located at c:\fax named faxdata.dbf wich has a column called datefax (type Date) and another column called AMPM (type Char 2) and a third column called Lamount (type Integer) and what I need is to copy this value into the next column in the same Sheet (D7), as I said b4, only works until date 09/07/2004, Ive tried everything I know (not much of course) and couldn't make it work. <-------'
Thank you
PE
Im having problems with this macro (above), only works until date 09/07/2004, from 10 to 31 doesn't work. Please Help me!!
Sub Macro1()
Workbooks.Open Filename:="C:\TEMP\faxdata.DBF"
'the structure of that table is like this: fdata (date),hampm (char2, values AM and PM only), then 10 fields with values all integer'
Windows("C2004.xls").Activate
Dim rng As Range
Set rng = Sheets("07").Range("B7:B80")
'at B7 begins my dates from 01/07/04 until 31/07/04
For Each Cell In rng
If Cell <> "" Then 'explanation above at (1) mark
Data = Cell ' here I keep my Date
OPE = IIf(Cell.Offset(0, 1).Value = "a", "AM", "PM")
'I change a/p to AM/PM 'cause in faxdata the value is like that
Windows("faxdata.dbf").Activate
With Worksheets("faxdata").Range("A1:A1000")
Set c = .Find(Data, LookIn:=xlValues) 'I found this example and I take it
'but Idk how exactly means "LookIn:=xlValues"??
If Not c Is Nothing Then
'I guess this means If c has a value or not, right?
If OPE = "AM" Then
adrow = 0
Else
adrow = 18
End If
Cell.Offset(0, 2).Value = Cells(c.Row + adrow, 11)
Cell.Offset(0, 3).Value = Cells(c.Row + adrow + 1, 11)
Cell.Offset(0, 4).Value = Cells(c.Row + adrow + 2, 11)
Cell.Offset(0, 7).Value = Cells(c.Row + adrow + 12, 11)
'at C2004.xls I replace the values i need it
End If
End With
End If
Windows("C2004.xls").Activate
Next
End Sub
'(1) ----> here I want to select the value of the next column , for example if the cursor is positioning at B7 with value "03/07/2004" I would like to obtaint C7 value (only "AM" and "PM" is saved in this cells), then with this 2 values I need to look into a .DBF file located at c:\fax named faxdata.dbf wich has a column called datefax (type Date) and another column called AMPM (type Char 2) and a third column called Lamount (type Integer) and what I need is to copy this value into the next column in the same Sheet (D7), as I said b4, only works until date 09/07/2004, Ive tried everything I know (not much of course) and couldn't make it work. <-------'
Thank you
PE