Name error copy cell to another

Gregfox

Board Regular
Joined
Apr 12, 2011
Messages
120
I’m trying to use VBA to test if cell (in the active row) [C] has no number in it or is blank, and also test if [F] has a number in it. If true then copy the condense of [F] to [M].
Everything seems to work until it get to the last line “copy “F” to M” I get a #NAME error.
Thanks.
Code:
Sub CopyTo_M()
'
If (Range("C" & ActiveCell.Row).Value > 0)And (IsNumeric(Range("c" & ActiveCell.Row).Value) OrApplication.WorksheetFunction.IsText(Range("c" &ActiveCell.Row).Value)) Then
Range("m" & ActiveCell.Row).Value = "E XI T -C is not empty"
Exit Sub

ElseIf (Range("F" & ActiveCell.Row).Value >0) And (IsNumeric(Range("F" & ActiveCell.Row).Value)) Then
Range("m" & ActiveCell.Row).Value ="F  IS numberic,  C is blank"

Range("m" & ActiveCell.Row).Formula ="=+sum(f)"  '<--ERROR==========

Else
Range("m" & ActiveCell.Row).Value = "Cand F are empty"

End If
END SUB





End Sub
[/code]
Thanks.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
How about
Code:
Range("m" & ActiveCell.Row).value=Range("f" & ActiveCell.Row).value
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top