LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Prevent macro calculate if text in the range


I tryed to make the macro exit if there has been written text in range
D4:D53, but not succeed. can anyone help please?

Sub Add_hours()
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:""
Dim r As Range
Dim v As Range
Set v = Range("D4:D53")
Set r = Range("F4:F53")
If Range("D4:53")HERE IS MY PROBLEM!!! Then GoTo errorline Else: GoTo
line1
line1:
r.FormulaR1C1 = "=RC[-2]+RC[-1]"
r.Copy
Range("E4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
r = ""
v.FormulaR1C1 = "0"
GoTo Lastline
errorline:
MsgBox ("Kun tall")
Lastline:
ActiveSheet.Protect Password:="", DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
 
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
How do I prevent a long string of text from wrapping in a text fil stevekaz21 Excel Discussion (Misc queries) 1 October 23rd 09 03:46 PM
Create macro to calculate data range for a running chart James Lucero Excel Worksheet Functions 1 April 29th 08 04:27 PM
Sometimes range calculate doesn't work in macro. Why? Don Wiss Excel Programming 3 January 4th 05 05:37 PM
TO TOM OR KEN: macro to calculate selected range mary Excel Programming 3 January 19th 04 05:45 PM
prevent recalculation of random data except in a "Calculate" macro matt dunbar Excel Programming 1 December 10th 03 01:02 PM


All times are GMT +1. The time now is 01:49 AM.

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

About Us

"It's about Microsoft Excel"