View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default If then Function Problems

Hi,

Alt +F11 to open Vb editor. Right click 'this workbook' insert module and
paste this in

Sub copyit()
Dim MyRange, MyRange1 As Range
Sheets("Sheet1").Select
lastrow = Sheets("Sheet1").Range("A65536").End(xlUp).Row
Set MyRange = Range("A1:A" & lastrow)
For Each c In MyRange
If Weekday(c.Value) = vbFriday Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.Resize(, 5)
MyRange1.Select
Else
Set MyRange1 = Union(MyRange1, c.Resize(, 5))
End If
End If
Next
MyRange1.Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
End Sub


Does that help?
Mike
"MJ" wrote:

I have a spreadsheet that has the date in column A in this form "Friday,
March 06, 2008" and I wanted to be able to pull every row that has a friday
and put into a seperate worksheet.

So ever day that is a friday will put then next 4 cells in the row into a
sheet 2.

I know there is a way to do this but my VB is weak to say the least.

Thanks
MJ