我有这段代码来存储数组中所选范围的值。
dim lRow, i as Integer
dim rngValues() as Variant
rngValues = thisworkbook.Sheets(2).Range("C2:C" & lRow)
For i = LBound(rngValues) To UBound(rngValues)
Debug.Print rngValues(i) ' this lines returns Type Mismatch error.
Next i
在对列进行一些修改后,我必须将其粘贴回列中。你能帮我解决这个问题吗?
答案 0 :(得分:2)
编辑以特定格式返回日期值
正如Tim Williams所说,你的rngValues数组是2D的
要将其作为一维数组,您可以按如下方式编码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="6dip" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="User: "
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:text="Pass: "
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginTop="20dp" />
<Button
android:text="Delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/delete"
android:layout_alignBaseline="@+id/edit"
android:layout_alignBottom="@+id/edit"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="24dp"
android:layout_marginEnd="24dp" />
<Button
android:text="Edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edit"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/delete"
android:layout_alignEnd="@+id/delete"
android:layout_marginRight="94dp"
android:layout_marginEnd="94dp" />
</RelativeLayout>