Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Why this simple macro doesn't work?

Dear friends
Someone can tell me why this simple macro doesn’t work?

Public Sub Pippo()
For j = 2 To 50
If Cells(j, 2) = "" Then
Exit For
End If
If Cells(j, 2) = "COPPIA RU*" Then
Cells(j, 4).Value = Cells(j, 4) * 2
End If
Next j
End Sub

Thank you very much for your help

I have attached a exampl

Attachment filename: pippo.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=43382
--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Why this simple macro doesn't work?

Hi Marco,

How's the sun?

To do pattern matching in VBA you need to use Like, such as

Public Sub Pippo()
For j = 2 To 50
If Cells(j, 2) = "" Then
Exit For
End If
If Cells(j, 2) Like "COPPIA RU*" Then
Cells(j, 4).Value = Cells(j, 4) * 2
End If
Next j
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"71marco71 " wrote in message
...
Dear friends
Someone can tell me why this simple macro doesn't work?

Public Sub Pippo()
For j = 2 To 50
If Cells(j, 2) = "" Then
Exit For
End If
If Cells(j, 2) = "COPPIA RU*" Then
Cells(j, 4).Value = Cells(j, 4) * 2
End If
Next j
End Sub

Thank you very much for your help

I have attached a example

Attachment filename: pippo.xls
Download attachment:

http://www.excelforum.com/attachment.php?postid=433823
---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Why this simple macro doesn't work?

Public Sub Pippo()
For j = 2 To 50
If Cells(j, 2) = "" Then
Exit For
End If
If Instr(1,Cells(j, 2),"COPPIA RU",vbTextCompare) = 1 Then
Cells(j, 4).Value = Cells(j, 4) * 2
End If
Next j
End Sub

--
Regards,
Tom Ogilvy


"71marco71 " wrote in message
...
Dear friends
Someone can tell me why this simple macro doesn't work?

Public Sub Pippo()
For j = 2 To 50
If Cells(j, 2) = "" Then
Exit For
End If
If Cells(j, 2) = "COPPIA RU*" Then
Cells(j, 4).Value = Cells(j, 4) * 2
End If
Next j
End Sub

Thank you very much for your help

I have attached a example

Attachment filename: pippo.xls
Download attachment:

http://www.excelforum.com/attachment.php?postid=433823
---
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
Simple formulas don't work (very very weird) brandon_05mn New Users to Excel 2 July 15th 09 12:33 PM
why doesn't this simple macro work in excel 2007? ManhattanRebel Excel Discussion (Misc queries) 8 July 19th 08 06:37 PM
So simple, but I can't get it to work hmsawyer Excel Discussion (Misc queries) 4 April 5th 08 07:58 AM
simple deletion won't work for me jgriffs Excel Discussion (Misc queries) 2 January 29th 06 09:55 PM
Simple but I can't get it to work? PLEASE help!! Naji Excel Discussion (Misc queries) 6 January 11th 06 10:27 PM


All times are GMT +1. The time now is 01:33 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"