activecell.paste error

agus setiawan

New Member
Joined
Oct 21, 2020
Messages
3
Office Version
  1. 365
hey i just try to learn excel more deep and it fun, i make my own data for my little store but i got trouble in this coding
VBA Code:
Sub SimpanData()

Sheets("TRANSAKSI KASIR").Select
Range("C8:L8").Offset(1, 0).Select                    
If Range("E6") = 1 Then                           
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Else
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
End If
Selection.Copy


ThisWorkbook.Worksheets("DAFTAR TRANSAKSI").Visible = xlSheetVisible
Worksheets("DAFTAR TRANSAKSI").Unprotect Password:="1234"
Sheets("DAFTAR TRANSAKSI").Select
If Range("B3").Offset(1, 0).Value = "" Then        
Range("B3").Offset(1, 0).Select
Else
Range("B3").End(xlDown).Offset(1, 0).Select
End If


ActiveCell.PasteSpecial            >>>>>> this the trouble maker


    Application.CutCopyMode = False
Worksheets("DAFTAR TRANSAKSI").Protect Password:="1234", UserInterfaceOnly:=True
ThisWorkbook.Worksheets("DAFTAR TRANSAKSI").Visible = xlSheetHidden

End Sub
 
Last edited by a moderator:

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,680
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
What is the error?
 

agus setiawan

New Member
Joined
Oct 21, 2020
Messages
3
Office Version
  1. 365
iam not sure, because when i run it the "activecell paste special" make an error / debug
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
614
Office Version
  1. 2013
Platform
  1. Windows
VBA Code:
Activecell.PasteSpecial ...

Should be
VBA Code:
Selection.PasteSpecial ...
 
Last edited:

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,680
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS

ADVERTISEMENT

If it 'makes an error', you must know what the error message is.
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
614
Office Version
  1. 2013
Platform
  1. Windows
Example
VBA Code:
Selection.PasteSpecial Paste:=xlPasteValues
 

Watch MrExcel Video

Forum statistics

Threads
1,114,524
Messages
5,548,553
Members
410,848
Latest member
anuradhagrewal
Top