Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Wheres the bug

Hi gang
Here's my cod
Sub summary2(

Application.ScreenUpdating = Tru
Dim i As Intege
Dim myVal As Strin
On Error Resume Nex
Application.DisplayAlerts = Fals
Worksheets("Summary").Delet
Application.DisplayAlerts = Tru
Worksheets.Add(Worksheets(1)).Name = "Summary
For i = Worksheets("Start").Index + 1 To Worksheets("End").Index -
myVal = Worksheets(i).Range("P13").Tex
If Left(myVal,2) = "F
Then Worksheets(i).Selec
Range("P10:p38").Cop
Worksheets("Summary").Selec
Range("IV1").End(xlToLeft)(1, 2).Selec
Selection.PasteSpecial Paste:=xlPasteValue
Selection.PasteSpecial Paste:=xlPasteFormat
'End I
Next

Im getting a syntax error on ....If Left(myVal,2) = "F
Wheres the bug

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Wheres the bug

The Syntax is If...Then

Your line is split. Either joint it with the " _" (space-underscore)
compiler directive, or move the following line up to read

If Left(myVal,2) = "F" Then Worksheets(i).Select


In article ,
Catherine wrote:

Hi gang!
Here's my code
Sub summary2()

Application.ScreenUpdating = True
Dim i As Integer
Dim myVal As String
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Summary").Delete
Application.DisplayAlerts = True
Worksheets.Add(Worksheets(1)).Name = "Summary"
For i = Worksheets("Start").Index + 1 To Worksheets("End").Index - 1
myVal = Worksheets(i).Range("P13").Text
If Left(myVal,2) = "F"
Then Worksheets(i).Select
Range("P10:p38").Copy
Worksheets("Summary").Select
Range("IV1").End(xlToLeft)(1, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
'End If
Next i

Im getting a syntax error on ....If Left(myVal,2) = "F"
Wheres the bug?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Wheres the bug

Besides the then being on the line below, you should be asking about case
and 1 vs 2 for F.
If ucase(Left(myVal,1)) = "F"
Also, why delete the summary sheet - just to re-create. why not
Worksheets("Summary").usedrange.clear
or something like it?
Also, try to remove selecting

worksheets(i).range("P10:p38").Copy
with Worksheets("Summary").Range("IV1").End(xlToLeft)(1 , 2)
.PasteSpecial Paste:=xlPasteValues
.PasteSpecial Paste:=xlPasteFormats
end with
end if
--
Don Guillett
SalesAid Software

"Catherine" wrote in message
...
Hi gang!
Here's my code
Sub summary2()

Application.ScreenUpdating = True
Dim i As Integer
Dim myVal As String
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Summary").Delete
Application.DisplayAlerts = True
Worksheets.Add(Worksheets(1)).Name = "Summary"
For i = Worksheets("Start").Index + 1 To Worksheets("End").Index - 1
myVal = Worksheets(i).Range("P13").Text
If Left(myVal,2) = "F"
Then Worksheets(i).Select
Range("P10:p38").Copy
Worksheets("Summary").Select
Range("IV1").End(xlToLeft)(1, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
'End If
Next i

Im getting a syntax error on ....If Left(myVal,2) = "F"
Wheres the bug?

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Wheres the bug

Hi Do
Thanks for the respons
I am deleting an existing summary and adding the new one that I have created
Maybe I should be copying over the old data. Just felt safer deleting i
Thanks again!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Wheres the bug

If you are only matching one letter, it should be

Left(myVal,1) = "F

--
Message posted from http://www.ExcelForum.com



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
Excel: wheres menu item to change file format conversion options? Serge Excel Discussion (Misc queries) 1 December 14th 05 08:55 PM


All times are GMT +1. The time now is 07:16 AM.

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"