Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Sort by cell contents
Using a macro in Excel 2007. I have a cell in P1 with a date in it, and I
need to pull data from G-K that correspond to this date (dates are held in column G). The code I have looks like this but does not work. I am certain the line 'If c.Value Like "Range(P1).value" Then' is wrong, but I don't know how to compare a c.value to a cell value. Thanks for the help. Sub Test() RowCount = 1 For Each c In Range("G:G") If c.Value Like "Range(P1).value" Then Cells(RowCount, "R").Value = c.Value Cells(RowCount, "S").Value = c.Offset(0, 1).Value Cells(RowCount, "T").Value = c.Offset(0, 2).Value Cells(RowCount, "U").Value = c.Offset(0, 3).Value Cells(RowCount, "V").Value = c.Offset(0, 4).Value RowCount = RowCount + 1 End If Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
concatenate contents of cells whose contents resemble cell referem | Excel Worksheet Functions | |||
how do I sort rows by the contents of one cell | Excel Discussion (Misc queries) | |||
Excel Sort Contents of cells | Excel Discussion (Misc queries) | |||
How do I sort contents alphabetically in Excel? | Excel Discussion (Misc queries) | |||
Macro to remove contents of cell and move all other contents up one row | Excel Discussion (Misc queries) |