• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Formula Error

riyaj

New Member
Hello Experts,


WHen I tried to run below macro it throw errors , I apologies as I am newbie person in VBA, could you guys please tell me where am I going wrong here please ?

Below Code was meant for finding percentages figures and insert a min 100 percentage formula in it.


------------------------------------------------------------------------------------


Sub InsertMinPercent()

Dim ws As Worksheet

Dim k As Range

Dim s As String

For Each ws In ActiveWorkbook.Worksheets


s = k.Text

If Right(s, 1) = "%" Then

Application.Run "'QC Errors progress .xlsm'!MinHundred"

End If


Next ws

End Sub


[Sub MinHundred()

Dim R As Range

On Error Resume Next

For Each R In Selection.SpecialCells(xlCellTypeFormulas)

R.Formula = "=Min(" & Mid(R.Formula, 2) & ",""1")

Next R

End Sub]
 
Please note that [] signs for sub macro MinHundred() are not in actual code and for understanding purpose only...
 
Hi, riyaj!

In 1st procedure, the 1st instruction within the For...Next loop refers to "k.Text" but "k" even if defined as range hasn't been initialized with the proper value. If the error isn't displayed in that line, please elaborate a bit more and provide detailed info.

Regards!
 
Back
Top