I have search for 2 days only to find complex solutions. What i want to do is simpler. I have a current working VBA sub that selects a formula from one cell, named ("StockPriceFormula") and copy/pastes down a named range ("CurrStockPrcRange").
Current Working VBA:
=====================
Sub UpdateAllQuotes()
Range("StockPriceFormula").Select
Selection.Copy
Application.Goto Reference:="CurrStockPrcRange"
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
=====================
What I want to add to that code is to SKIP pasting the formula to cells correspond to a value of the letter "C" in an adjacent Named Range. i.e. Range("StatusRange) <> "C"
What I want to add to the above VBA:
=====================
Sub UpdateAllQuotes()
Range("").Select
Selection.Copy
Application.Goto Reference:="CurrStockPrcRange"
'(ADD VBA code/Loop here to ONLY Paste if adjacent cell in Range("StatusRange") does
NOT have the letter "C" in it)
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
=====================
I want to use "Named Ranges" not Column/Cell Letters/Numbers because the size and location of ranges changes depending on how my items are in the worksheet.
Example Worksheet:
[TABLE="class: grid, width: 10, align: left"]
<tbody>[TR]
[TD]
[TD="align: center"]B
SYMBOL[/TD]
[TD="align: center"]C
Status[/TD]
[/TR]
[TR]
[TD]skip this cell[/TD]
[TD]XYZ[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]36.95[/TD]
[TD]ABC[/TD]
[TD]O[/TD]
[/TR]
[TR]
[TD]skip this cell[/TD]
[TD]DFG[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]43.50[/TD]
[TD]UV[/TD]
[TD]O[/TD]
[/TR]
</tbody>[/TABLE]
Current Working VBA:
=====================
Sub UpdateAllQuotes()
Range("StockPriceFormula").Select
Selection.Copy
Application.Goto Reference:="CurrStockPrcRange"
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
=====================
What I want to add to that code is to SKIP pasting the formula to cells correspond to a value of the letter "C" in an adjacent Named Range. i.e. Range("StatusRange) <> "C"
What I want to add to the above VBA:
=====================
Sub UpdateAllQuotes()
Range("").Select
Selection.Copy
Application.Goto Reference:="CurrStockPrcRange"
'(ADD VBA code/Loop here to ONLY Paste if adjacent cell in Range("StatusRange") does
NOT have the letter "C" in it)
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
=====================
I want to use "Named Ranges" not Column/Cell Letters/Numbers because the size and location of ranges changes depending on how my items are in the worksheet.
Example Worksheet:
[TABLE="class: grid, width: 10, align: left"]
<tbody>[TR]
[TD]
A
CurrStocPrcRange[/TD][TD="align: center"]B
SYMBOL[/TD]
[TD="align: center"]C
Status[/TD]
[/TR]
[TR]
[TD]skip this cell[/TD]
[TD]XYZ[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]36.95[/TD]
[TD]ABC[/TD]
[TD]O[/TD]
[/TR]
[TR]
[TD]skip this cell[/TD]
[TD]DFG[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]43.50[/TD]
[TD]UV[/TD]
[TD]O[/TD]
[/TR]
</tbody>[/TABLE]