Addressing a shape data value using VBA

M

MikeM

I want to assign sex to a shape based on some outside criterion, using VBA. I
thought I could just use, in the shape data section (with Type = 1 and Format
= "M;F")

with [shape]
if [condition] then .cells("Prop.Sex") = "M" else .cells("Prop.Sex") = "F"
end with

Then I tried 0 and 1 instead of "M" and "F", but that didn't work either.

How do I change the value in that cell?

TIA,
Mike
 
D

David Parker

You need to assert the string as follows (use doduble-double-quotes):

with [shape]
if [condition] then .cells("Prop.Sex").FormulaU = "=""M""" else
..cells("Prop.Sex").FormulaU = "=""F"""
end with
 
M

MikeM

Thanks, David!

David Parker said:
You need to assert the string as follows (use doduble-double-quotes):

with [shape]
if [condition] then .cells("Prop.Sex").FormulaU = "=""M""" else
.cells("Prop.Sex").FormulaU = "=""F"""
end with


MikeM said:
Those are nice to know, June2, but they don't solve my VBA problem.

Mike
 

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

Top