Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro help
Hi I have this macro that checks the values of the various cell starting from "CURRENT RANGE" I would like very much to have the macro start count at the current location of the cursor. Can anyone help with this Thanks Ian M Dim i As Integer Dim MyText As String, List, myTotal As Double Dim Cell As Range, rng As Range Set rng = Range("currentrange") rng.Select Set cmt = ActiveSheet.Comments Selection.SpecialCells(xlCellTypeComments).Select For Each Cell In Selection Cell.Select myTotal = 0 MyText = Cell.Comment.Text If Selection.Interior.Color = 16711680 Then Selection.Font.Color = -16711681 Selection.Font.TintAndShade = 0 Else With Selection.Font .ColorIndex = xlAutomatic .TintAndShade = 0 End With End If If InStr(MyText, "?") Then With Selection.Font .Color = -16776961 .TintAndShade = 0 End With End If MyText = MyText + " " 'look for "=" For z1% = 1 To Len(MyText) If Mid(MyText, z1%, 1) = "=" Then 'look for value Value$ = "" For z2% = z1% + 1 To Len(MyText) If IsNumeric(Mid(MyText, z2%, 1)) Then Value$ = Value$ + Mid(MyText, z2%, 1) Else If Value$ < "" Then myTotal = myTotal + Val(Value$): z1% = z2%: Exit For End If Next End If 'ActiveCell.FormulaR1C1 = myTotal Next ActiveCell.FormulaR1C1 = myTotal Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to copy and paste values (columns)I have a macro file built | Excel Programming | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |