macro

  • Thread starter Thread starter nowfal
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
You were it by line wrap. This should be on one line:

If Intersect(Target, Range("C2:C2")) Is Nothing Then Exit Sub
 
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
 

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

Back
Top