#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 337
Default Greater than

Whats wrong with this?
Windows("TempData.XLS").Activate 'Recalls scrap rates
If D21 0 Then
Range("D21:D23").Select
Selection.Copy
Windows(MasterSheet).Activate
Range("AD21").Select
Selection.PasteSpecial Paste:=xlFormulas
End If

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Greater than

You are missing sheet names and MasterSheet may need double quotes. See
comments below

'change sheet anem as required
with workbooks("TempData.XLS").sheets("Sheet1")
if .Range("D21") 0 then
.Range("D21:D23").Copy
'Is MasterSheet a variable name. I put double quotes
'Change sheet name as required
workbooks("MasterSheet").sheets("Sheet1").Range("A D21") _
.PasteSpecial Paste:=xlFormulas
end if

end with

"oldjay" wrote:

Whats wrong with this?
Windows("TempData.XLS").Activate 'Recalls scrap rates
If D21 0 Then
Range("D21:D23").Select
Selection.Copy
Windows(MasterSheet).Activate
Range("AD21").Select
Selection.PasteSpecial Paste:=xlFormulas
End If

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 337
Default Greater than

Thanks - I just added the range and quotes and it worked.

If Range("D21") 0 Then

Why does the following code work that is just below the other code

If F31 = Empty Then 'Recalls estimator, sales person and commission %

Range("F31").Select
Selection.Copy
Windows(MasterSheet).Activate
Range("AF31").Select
Selection.PasteSpecial Paste:=xlValues

"Joel" wrote:

You are missing sheet names and MasterSheet may need double quotes. See
comments below

'change sheet anem as required
with workbooks("TempData.XLS").sheets("Sheet1")
if .Range("D21") 0 then
.Range("D21:D23").Copy
'Is MasterSheet a variable name. I put double quotes
'Change sheet name as required
workbooks("MasterSheet").sheets("Sheet1").Range("A D21") _
.PasteSpecial Paste:=xlFormulas
end if

end with

"oldjay" wrote:

Whats wrong with this?
Windows("TempData.XLS").Activate 'Recalls scrap rates
If D21 0 Then
Range("D21:D23").Select
Selection.Copy
Windows(MasterSheet).Activate
Range("AD21").Select
Selection.PasteSpecial Paste:=xlFormulas
End If

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Greater than

Fe1 is a variable and not a cell on the worksheet. Because you haven't used
the variable before it is Empty. the activeworkshhet of a work book is the
last active sheet before it was closed. You can't dependc on a workbook
always opening to the same sheet unless there is only one sheet in the
workbook.

"oldjay" wrote:

Thanks - I just added the range and quotes and it worked.

If Range("D21") 0 Then

Why does the following code work that is just below the other code

If F31 = Empty Then 'Recalls estimator, sales person and commission %

Range("F31").Select
Selection.Copy
Windows(MasterSheet).Activate
Range("AF31").Select
Selection.PasteSpecial Paste:=xlValues

"Joel" wrote:

You are missing sheet names and MasterSheet may need double quotes. See
comments below

'change sheet anem as required
with workbooks("TempData.XLS").sheets("Sheet1")
if .Range("D21") 0 then
.Range("D21:D23").Copy
'Is MasterSheet a variable name. I put double quotes
'Change sheet name as required
workbooks("MasterSheet").sheets("Sheet1").Range("A D21") _
.PasteSpecial Paste:=xlFormulas
end if

end with

"oldjay" wrote:

Whats wrong with this?
Windows("TempData.XLS").Activate 'Recalls scrap rates
If D21 0 Then
Range("D21:D23").Select
Selection.Copy
Windows(MasterSheet).Activate
Range("AD21").Select
Selection.PasteSpecial Paste:=xlFormulas
End If

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 337
Default Greater than

Thanks so much

"oldjay" wrote:

Whats wrong with this?
Windows("TempData.XLS").Activate 'Recalls scrap rates
If D21 0 Then
Range("D21:D23").Select
Selection.Copy
Windows(MasterSheet).Activate
Range("AD21").Select
Selection.PasteSpecial Paste:=xlFormulas
End If

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Less than or Greater than Andy B[_2_] Excel Discussion (Misc queries) 1 March 5th 09 09:14 PM
greater than less than Rene Excel Discussion (Misc queries) 7 November 2nd 08 01:16 PM
Last Value Greater Than Zero Anto111 Excel Discussion (Misc queries) 7 May 31st 08 06:56 PM
Greater Than and less than HELP PLEASE Chris In Need Excel Discussion (Misc queries) 4 May 8th 08 10:56 PM
I have Greater than, I need less than also rlee1999 Excel Worksheet Functions 3 December 12th 06 07:52 PM


All times are GMT +1. The time now is 08:24 AM.

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

About Us

"It's about Microsoft Excel"