yliew
Civil/Environmental
- Jan 16, 2002
- 19
Dear all,
I am new in VBA for Excel and currently writing some procedures for my research. The following is a simple code which I wrote but I wish to extend it's capability:
_____________
Sub generatedata()
Max_displacement = InputBox("Enter Maximum Displacement: "
For i = 0 To Max_displacement
Range("B1"
= i
Range("B1"
.Copy _
Range("B1"
.Offset(i + 4, -1)
Range("B2"
.Select
Selection.Copy
Range("B1"
.Offset(i + 4, 0).Select
Selection.PasteSpecial Paste:=xlValues
Next i
End Sub
______________
As you can see, this procedure copy the data from cell B1 and B2(contains formula which changes with B1) and paste it to two column of cells. However, the "i" value only increase by 1 everytime. I would like it to increase by 0.1 everytime up to the Max_displacement. Are there any special command I can use or I should use a counter.
Thanks!
Regards,
YEN
I am new in VBA for Excel and currently writing some procedures for my research. The following is a simple code which I wrote but I wish to extend it's capability:
_____________
Sub generatedata()
Max_displacement = InputBox("Enter Maximum Displacement: "
For i = 0 To Max_displacement
Range("B1"
Range("B1"
Range("B1"
Range("B2"
Selection.Copy
Range("B1"
Selection.PasteSpecial Paste:=xlValues
Next i
End Sub
______________
As you can see, this procedure copy the data from cell B1 and B2(contains formula which changes with B1) and paste it to two column of cells. However, the "i" value only increase by 1 everytime. I would like it to increase by 0.1 everytime up to the Max_displacement. Are there any special command I can use or I should use a counter.
Thanks!
Regards,
YEN