#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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
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
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"