Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2022, 06:03 AM
Matt C's Avatar
Matt C Matt C is offline Excel 2003: VBA "Function" causes "#VALUE!" errors after running "insert/delete row" custom macro Windows 10 Excel 2003: VBA "Function" causes "#VALUE!" errors after running "insert/delete row" custom macro Office 97-2003
Advanced Beginner
Excel 2003: VBA "Function" causes "#VALUE!" errors after running "insert/delete row" custom macro
 
Join Date: May 2021
Location: London, UK
Posts: 30
Matt C is on a distinguished road
Default

Hi. Thanks for this. It half works.

I've added the line as you suggested:

Quote:
Function SumCat(WorkRng As Range)
'


' SumCat Function
'
' Calculates cells formatted as "Total Category"
' Example: =SUMCAT(A1:C9)
'
Dim rng As Range
Dim xSum As Long

Application.Volatile

For Each rng In WorkRng
' Finds cells with "Total Category" stylename
If rng.Style = "Total Category" Then
xSum = xSum + rng.Value
End If

Next

SumCat = xSum

End Function
The "Insert Row" macro (see code in first post) now seems to work fine, but I'm still getting the error after running the "Delete Row" macro (code below).

Quote:
Sub DeleteRow()
'
' DeleteRow Macro
'
response = MsgBox("Are you sure you want to remove this row?", vbYesNo)

If response = vbYes Then

ActiveCell.Rows("1:1").EntireRow.Select
Selection.Delete Shift:=xlUp

Else
Exit Sub

End If

End Sub
As before, deleting a row manually does not result in the "#VALUE!" error.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional function to operate a formula based on "Yes" or "No" Condition Des ONeill Excel 1 07-03-2021 12:17 AM
Condtional function to operate a formula based on "Yes" or "No" Des ONeill Excel 3 07-03-2021 12:16 AM
How do I delete the names under "Exceptions" when I use the "Restrict Editing" feature in Word? MengS Word 0 02-25-2015 02:57 PM
remove repeated words with " macro " or " wild cards " in texts with parentheses and commas jocke321 Word VBA 2 12-10-2014 11:27 AM
Excel 2003: VBA "Function" causes "#VALUE!" errors after running "insert/delete row" custom macro How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft