|
hi all ,
i have this problem on my program codes that im not sure how to edit it. i want to extract only selected cells but my program codes extract the unwanted cells too. please help me on this.
these are the codes that i have done.
im not sure how to write the programs codes lines with condition apply if i want to select only the data within the range from the column date found to the row date found that match the given date.
code:
--------------------------------------------------------------------------------
Sub get_data8()
Dim dteDateIn As Date
dteDateIn = Range("A32").Value
Range("G4").Select
Range(Selection, Selection.End(xlToRight)).Select
For Each testcell In Selection
If dteDateIn = testcell.Value Then
NextFourForward = Range(Cells(4, testcell.Column + 0), Cells(4, testcell.Column + 3)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("B33").Select
ActiveSheet.Paste
Exit For
End If
Next testcell
Range("E5").Select
Range(Selection, Selection.End(xlDown)).Select
For Each testcell In Selection
If dteDateIn = testcell.Value Then
NextFourUpward = Range(Cells(testcell.Row - 0, 5), Cells(testcell.Row - 3, 5)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("a34").Select
ActiveSheet.Paste
Exit For
End If
Next testcell
Cells(33, 1).Select
End Sub
-----------------------------------------
Thank you and regards,
Rachel
|
|
|
|
|
|
|
|