Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Simple formulas don't work (very very weird) | New Users to Excel | |||
why doesn't this simple macro work in excel 2007? | Excel Discussion (Misc queries) | |||
So simple, but I can't get it to work | Excel Discussion (Misc queries) | |||
simple deletion won't work for me | Excel Discussion (Misc queries) | |||
Simple but I can't get it to work? PLEASE help!! | Excel Discussion (Misc queries) |