Looking for VBA code to Paste Special Value only if cell in Range is Populated

jbench18

New Member
Joined
Feb 12, 2013
Messages
24
Hey everyone,

First time post on here. I figured I can reach out to some of you guru's as I've been trying to figure this out on my own, and haven't been able to. I'm trying to find a way to paste special value cell(s) in a range ONLY if the cell contains a number. The attachment should help explain, what I'm trying to do, but the end result should have all the cells C2:F32 populated with a number (2nd tab titled "Scoring"). Below is the current code I'm working with...

Sub MacroLogData()

Sheets("Scoring (2)").Range("C2:F32").Copy Sheets("Scoring").Range("C2")

With Sheets("Scoring").Range("C2:F32").SpecialCells(xlFormulas, 1)
.Value = .Value
End With

Sheets("Scoring").Range("G2") = ""
Sheets("Response Tool").Range("C5").ClearContents

End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
i dont get what you trying to explain, are you going to paste the special value from C2 to F32 into other sheet C2 to F32 if the value is a number?
 
Upvote 0
I want to copy / paste the formulas only if there are NO values currently loaded. Basically I am looking for a code that says only copy and paste the formulas if the cell(s) in the range of C2:F32 are blank. The problem is when I answer one question it does the paste special value. Then when I run the macro again the formula is replacing the paste special value.

For example..if the response to the first question gets populated in cell C5, the next time I run the macro I want it to populate the range (C2:F32) with the formula except for C5. Let's say the response to the 2nd question gets populated in D5. For the third question when the macro is run I want it to populate the range with formula except for C5 and D5. Ultimately in the end all the cells in the range will have a numeric value bw 1-5. I hope this helps clarify.
 
Upvote 0
Is it possible to attach the spreadsheet I'm working with..it's probably easier to look it.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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