Here is the formula I found that pastes my nutrition program start date as the first date in the 12 week program. I then just have the date+1 filled down for 12 weeks. I see there is a message box in this formula but can't get that to work if I take out the '.
Not sure what I'm doing wrong.
Private Sub CommandButton1_Click()
Dim lookfor As Variant
Dim Rng As Range
Application.Goto reference:="r7c4"
Selection.Copy
lookfor = Sheets("sheet2").Range("c3").Value
If Trim(lookfor) <> "" Then
With Sheets("sheet2").Range("e:e")
Set Rng = .Find(What:=lookfor, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Offset(0, 3)
'Set Rng = .Find(What:=lookfor).Offset(0, 3)
ActiveSheet.Select
'Application.Goto reference:="r1c1"
' If Not Rng Is Nothing Then
Application.Goto Rng, True
' Else
' MsgBox "Date Does Not Exist In 12 Week Program Range"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.Goto reference:="R7c4"
Selection.Copy
lookfor = Sheets("sheet2").Range("c3").Value
If Trim(lookfor) <> "" Then
With Sheets("sheet2").Range("e:e")
Set Rng = .Find(What:=lookfor).Offset(0, 1)
ActiveSheet.Select
Application.Goto Rng, True
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.Goto reference:="R8C4"
Selection.Copy
lookfor = Sheets("sheet2").Range("c3").Value
If Trim(lookfor) <> "" Then
With Sheets("sheet2").Range("e:e")
Set Rng = .Find(What:=lookfor).Offset(0, 2)
ActiveSheet.Select
Application.Goto Rng, True
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.Goto reference:="R9C4"
Selection.Copy
lookfor = Sheets("sheet2").Range("c3").Value
If Trim(lookfor) <> "" Then
With Sheets("sheet2").Range("e:e")
Set Rng = .Find(What:=lookfor).Offset(0, 3)
ActiveSheet.Select
Application.Goto Rng, True
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.Goto reference:="r1c1"
End With
End If
End With
End If
End With
End If
End With
End If
End Sub