P
Paul
Hello! Especially Tom
I have the best code supplied by tom to copy range based on data in a cell,
however Is there a way to copy and paste the exact value.
CODE START FINISH Monday Tuesday
MAIN 3 Apr 4 Apr
7:00 15:00
7:00 15:30 TRICIA SUE
7:00 15:30
7:30 16:00 JEANNE ANNA
call Jack Jo
the dates are entered as a formula, $f2+1. But when I run the macro the
resulting date which is printed in the new sheet is 1 Jan
I have now added an hours column in d. what changed would I need to make
Here is the code Tom provided
Public Sub daily()
Dim rng As Range, rng2 As Range
Dim sh As Worksheet, sh1 As Worksheet
Dim res As Variant
Dim dt As Date, s As String
s = InputBox("Enter date")
If Not IsDate(s) Then
MsgBox "Entry was not a date"
Exit Sub
End If
dt = CDate(s)
Set rng = Range("E2:bd2")
res = Application.Match(CLng(dt), rng, 0)
If IsError(res) Then
MsgBox "Bad date provided"
Exit Sub
End If
Set sh = ActiveSheet
Sheets.Add After:=Worksheets(Worksheets.Count)
Set sh1 = ActiveSheet
sh.Columns(2).Resize(, 2).Copy sh1.Range("A1")
rng(1, res).EntireColumn.Copy sh1.Range("D1")
Set rng2 = sh1.Columns(1).Find(What:="CALL", _
After:=sh1.Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If rng2 Is Nothing Then
MsgBox "Problems, Call not found"
Exit Sub
End If
sh1.Cells(rng2.Row + 1, 1).Resize(100).EntireRow.Delete
End Sub
Many thanks
I have the best code supplied by tom to copy range based on data in a cell,
however Is there a way to copy and paste the exact value.
CODE START FINISH Monday Tuesday
MAIN 3 Apr 4 Apr
7:00 15:00
7:00 15:30 TRICIA SUE
7:00 15:30
7:30 16:00 JEANNE ANNA
call Jack Jo
the dates are entered as a formula, $f2+1. But when I run the macro the
resulting date which is printed in the new sheet is 1 Jan
I have now added an hours column in d. what changed would I need to make
Here is the code Tom provided
Public Sub daily()
Dim rng As Range, rng2 As Range
Dim sh As Worksheet, sh1 As Worksheet
Dim res As Variant
Dim dt As Date, s As String
s = InputBox("Enter date")
If Not IsDate(s) Then
MsgBox "Entry was not a date"
Exit Sub
End If
dt = CDate(s)
Set rng = Range("E2:bd2")
res = Application.Match(CLng(dt), rng, 0)
If IsError(res) Then
MsgBox "Bad date provided"
Exit Sub
End If
Set sh = ActiveSheet
Sheets.Add After:=Worksheets(Worksheets.Count)
Set sh1 = ActiveSheet
sh.Columns(2).Resize(, 2).Copy sh1.Range("A1")
rng(1, res).EntireColumn.Copy sh1.Range("D1")
Set rng2 = sh1.Columns(1).Find(What:="CALL", _
After:=sh1.Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If rng2 Is Nothing Then
MsgBox "Problems, Call not found"
Exit Sub
End If
sh1.Cells(rng2.Row + 1, 1).Resize(100).EntireRow.Delete
End Sub
Many thanks