macro to run in event of cell value <>""

N

Norbert

Hi,
cell V3 has following formula:
=IF(ISERROR('common warps'!B4)=TRUE,"",'common warps'!B4)

In case B4 shows an error like N/A, V3 does not show anything, but in case
B4 shows a value e.g.: H12 (In this case H12 is not a cell, it is a value).

Is there a possibility to run a certain macro in the event of cell V3 showing a value?

regards,
Norbert
 
C

Claus Busch

Hi Norbert,

Am Tue, 28 Aug 2012 04:32:56 -0700 (PDT) schrieb Norbert:
cell V3 has following formula:
=IF(ISERROR('common warps'!B4)=TRUE,"",'common warps'!B4)

In case B4 shows an error like N/A, V3 does not show anything, but in case
B4 shows a value e.g.: H12 (In this case H12 is not a cell, it is a value).

Is there a possibility to run a certain macro in the event of cell V3 showing a value?

try in code module of the sheet:

Private Sub Worksheet_Calculate()
If Len([V3]) > 0 Then
your code
End If
End Sub


Regards
Claus Busch
 
N

Norbert

Hi Norbert,



Am Tue, 28 Aug 2012 04:32:56 -0700 (PDT) schrieb Norbert:


cell V3 has following formula:
=IF(ISERROR('common warps'!B4)=TRUE,"",'common warps'!B4)

In case B4 shows an error like N/A, V3 does not show anything, but in case
B4 shows a value e.g.: H12 (In this case H12 is not a cell, it is a value).

Is there a possibility to run a certain macro in the event of cell V3 showing a value?



try in code module of the sheet:



Private Sub Worksheet_Calculate()

If Len([V3]) > 0 Then

your code

End If

End Sub





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2

Hi Claus,
please check my code. I get a run time error '1004':
Select method of Range class failed
When I debug, it leads me to row 4: Range("A6").Select


Private Sub Worksheet_Calculate()
If Len([V3]) > 0 Then
Sheets("warp info").Select
Range("A6").Select
Selection.EntireRow.Insert
Rows("7:7").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A2:I2").Select
Selection.Copy
Range("A6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A6").Select
Application.CutCopyMode = False
Sheets("Planning tickets").Select
End If
End Sub
 
Joined
Sep 19, 2012
Messages
11
Reaction score
0
Hi, you still need to fully qualify the range reference even though you have selected or activated (I tried both) the other sheet (ie a sheet other than that which raised the event - in this case the calculate event). So:

Sheets("Sheet2").Select 'Activate also works here btw
Sheet2.Range("A14").Select

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top