I am trying to create excel Macro for my company. It looks like simple but I keep failing to get the result. I'm not a good VBA user so it would be big help for me if I got your assist.
The first sample template got "Dollor" amount and "No" fed from other source.
Now, my issue is on second template which needs to locate the cell at "Result" Column, using the row number from Cell " No " and paste "Dollor" amount ( Paste $100 at F5 on the sample sheet ).
Sub Test()
Range("A2").Select
Selection.Copy
Range("F& B2.Value&").Select
ActiveSheet.Paste
End Sub
For the range reference you show use
Range("F" & Range("B2").Value)
And you can say
Range("F" & Range("B2").Value) = Range("A2")
You should also include the full sheet reference to avoid implicitly working with the Activesheet.
An example, if sheet 1 could be:
With Worksheets("Sheet1")
.Range("F" & .Range("B2").Value) = .Range("A2")
End With
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.