#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default If/Then

This seems to work

Dim nm As String
Dim x, y As Integer
x = Sheets("DontDelete").Range("DontDelete!J6").Value
For y = 1 To x
nm = Sheets("DontDelete").Range("I8").Offset(y - 1, 0).Value
If Sheets(nm).Range("G21").Value < "No" Then
Sheets(nm).Range("Q2:AD2").Copy
Sheets("Timesheet").Select
Range("A19").Offset(y - 1, 0).PasteSpecial _
Paste:=xlValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
End If
Next y


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"I.P" wrote in message
ups.com...
Bob Phillips wrote:

Where did you try to add it and what did you add?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"I.P" wrote in message
ups.com...
I wish to move to the next worksheet if the current worksheet has the
text "no" in cell G21.I keep getting the message no "For or Goto" when
I put a If /Then line in the code.


Hi Bob
Dim nm As String
Dim x, y As Integer
Sheets("DontDelete").Select
x = Range("DontDelete!J6").Value
Range("I8").Select
For y = 1 To x
nm = ActiveCell.Value
Sheets(nm).Select
Range("G21").Select
If ("G21") = No Then
Sheets("DontDelete").Select
Next y
End If
Range("Q2:AD2").Select
Selection.Copy
Sheets("Timesheet").Select
Range("A19").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Sheets("DontDelete").Select
ActiveCell.Offset(1, 0).Activate
Next y

Ps ("DontDelete! I18") down is a list of people each with a identical
worksheet named after them
Thanks
Ian



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"