macro

N

nowfal

Hi,
Here is a small macro to copy and paste a list from one sheet t
another. But i need a help, If i put a number in C2, in "RECORD
greater than zero then the below said macro should fire.

Sub CUSTOMER()
'
' CUSTOMER Macro
' Macro recorded 09/09/2004 by Musandam
'

'
Sheets("CUST LIST").Select
Range("B1:D1").Select
Selection.Copy
Sheets("RECORD").Select
Range("D2:F2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Sheets("CUST LIST").Select
Range("B1").Select
Application.CutCopyMode = False
Sheets("RECORD").Select
Range("I2").Select
End Sub

any idea will be helpful
with regards
nowfa
 
D

Don Guillett

How about this that should work from anywhere in the workbook. NO
selections.

sub customer1()
with sheets("record")
if.range("b2")>0 then
.range("D2:F2").value= _
Sheets("CUST LIST").Range("B1:D1").value
end if
end with
 
N

nowfal

Sorry, i am again simplyfying the question, i want to trigger a macr
when the cell "C2">0 .
What should be done. I read the answer the early somewhere, but
couldn't recollect now.

thanks
nowfa
 
J

jeff

Hi,

right click on your Record tab; goto view code,
paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C2:C2")) Is Nothing Then Exit
Sub
If Range("C2:C2") > 0 Then CUSTOMER
End Sub

jeff
 
N

nowfal

Hi Jeff,
thanks for the reply, but i am getting a syntex error
i think this line is to be checked

If Intersect(Target, Range("C2:C2")) Is Nothing Then Exit
Sub

please do look in this matter.
by
nowfa
 
D

Dave Peterson

You were it by line wrap. This should be on one line:

If Intersect(Target, Range("C2:C2")) Is Nothing Then Exit Sub
 
N

nowfal

Mr.Dave peterson,
I was actually give up the matter from this group and tried in th
other group, there Mr. Ron de bruin had helped me, but later i foun
that code was not matching with me some runtime error is coming, No
when i check your answer it is perfectly alright, What you said i
correct. By this i have learned lot of things .
thanks you great guys.
by
nowfa
 
Top