Simple Excel VBA problem; Applying a formula to a column if it contains a number

  • Thread starter 6.28318531
  • Start date
54
0
Hello,

I have a relatively simple problem, You have two columns filled with numbers. I want my macro to go through and check the columns or one of the colums to see if it has a number in it, then operate on those numbers and display an output in a third column .

I tried this;
Code:
Sub Total()
'
' Total Macro
'

'


If IsNumeric(Range("H8", Range("H8").End(xlDown))) Then
Dim CopyRange As Range
Set CopyRange = Range("J8", Range("J8").End(xlDown))
   Sheets("Sheet1").Range(CopyRange.Address).FormulaR1C1 = "=RC[-1]*RC[-2]"

End If

End Sub
I know I can simply drag a formula but I want to automate this, and I also want to be able to reuse the same thing later.

Thanks for any help.
 

Want to reply to this thread?

"Simple Excel VBA problem; Applying a formula to a column if it contains a number" You must log in or register to reply here.

Related Threads for: Simple Excel VBA problem; Applying a formula to a column if it contains a number

  • Posted
Replies
0
Views
2K
Replies
0
Views
2K
Replies
0
Views
1K
Replies
0
Views
1K
Replies
0
Views
3K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top