My code doesn't work. I want to do A2 + 1 = A3
in macros, but when I tried to using p as integer, it gives me 1004 Global Error
. How to do (n,1) A2 + 1 = A3
in Excel VBA?
Sub agregarproducto()
Range("A7:G7").Select
Range("G7").Activate
Selection.Copy
Dim p As Integer
p = 0
p = Range("A2:A50").Count
p = p + 1
Range(p, 1).Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("E2:E3").Select
ActiveCell.FormulaR1C1 = "0"
Range("L11").Select
ActiveCell.FormulaR1C1 = "1"
End Sub
Change
Range(p, 1).Select
to
Cells(p, 1).select
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.