View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Mangesh Yadav[_4_] Mangesh Yadav[_4_] is offline
external usenet poster
 
Posts: 101
Default Macro Help!! 10 mins of your time need PLEASE!

Yes you can,

Search for columns A:A for 7-digit codes, and when you find one, put the
formula in the adjacent cell.

Use the following code for the purpose:

Private Sub CommandButton1_Click()

Set rng = Worksheets("Sheet1").Range("A1:A1000") ' change 1000 to a largest
row

For Each cl In rng
If Len(cl) = 7 And IsNumeric(cl) Then
cl.Offset(0, 1) = "=mysum(" & cl.Address & ",""L"")"
End If
Next

End Sub

Assumption: Your 7-digit codes are in column A and total number of rows you
are using is 1000

Mangesh



"pauldaddyadams"
<pauldaddyadams.1tafuk_1123239956.8961@excelforu m-nospam.com wrote in
message news:pauldaddyadams.1tafuk_1123239956.8961@excelfo rum-nospam.com...

Thanks for all your help on this!

I have done what Mangesh suggested and this has worked, dont know how
but im very happy it does.

That is one part out of the way, Would there be a a way that a macro
could be written to identify each uniquie 7 digit product code and
apply the =mysum(A9,"L") formula?

This was i would have to manualy enter the formula as i have alot of
data to do this for.

Paul


--
pauldaddyadams
------------------------------------------------------------------------
pauldaddyadams's Profile:

http://www.excelforum.com/member.php...o&userid=22499
View this thread: http://www.excelforum.com/showthread...hreadid=393228