Sub test()
Dim rng As Range
Dim not_rng As Variant
Set rng = Sheets("Test").Range("A1:B2")
Debug.Print TypeName(rng)
not_rng = rng
Debug.Print TypeName(not_rng)
End Sub
上面的代码打印
Range
Variant()
我希望打印Range, Variant
。
答案 0 :(得分:1)
啊,我错过了NSAttributedString * attributedString = [[NSAttributedString alloc]
initWithString:@"Temp String"
attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}];
[attributedString enumerateAttribute:NSForegroundColorAttributeName
inRange:NSMakeRange(0, attributedString.length)
options:0 usingBlock:^(id value, NSRange range, BOOL *stop) {
if (value) {
UIColor *color = (UIColor *)value;
NSLog(@"Color : %@", color);
}
}];
关键字:
Set
现在打印
Sub test()
Dim rng As Range
Dim not_rng As Variant
Set rng = Sheets("Test").Range("A1:B2")
Debug.Print TypeName(rng)
Set not_rng = rng
Debug.Print TypeName(not_rng)
End Sub
这更有意义。