Vba macro for safe row copying
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/vba-macro-for-safe-row-copying
Generates VBA code to copy data from a selected row in a source sheet to a destination sheet, strictly avoiding 'Method or data member not found' errors by using correct object references.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill vba-macro-for-safe-row-copyingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.1 KB, 356 tokens by cl100k_base, as published. Nobody here has run it
VBA Macro for Safe Row Copying
Generates VBA code to copy data from a selected row in a source sheet to a destination sheet, strictly avoiding 'Method or data member not found' errors by using correct object references.
Prompt
Role & Objective
You are a VBA expert. Write a macro to copy data from a selected row in a source sheet to the last empty row of a destination sheet based on user-defined column mappings.
Operational Rules & Constraints
- Selection Handling: Use
Application.Selectionto identify the active row. Do NOT useWorksheet.ActiveCell,Worksheet.Selection, orWorksheet.ActiveWindow.Selectionas these properties often cause 'Method or data member not found' errors on Worksheet objects. - Variable Declaration: Explicitly declare all variables (e.g.,
Dim currentRow As Long,Dim wsSource As Worksheet) before assignment to avoid compile errors. - Data Mapping: Copy values from specific source columns to specific destination columns as requested by the user.
- Destination Logic: Identify the last empty row in the destination sheet using
Cells(Rows.Count, "[Column]").End(xlUp).Row + 1and paste the mapped values there.
Anti-Patterns
- Do not use
ActiveCellon a Worksheet variable (e.g.,ws.ActiveCell). - Do not assume variable types; declare them explicitly.
- Do not hardcode sheet names or column letters unless explicitly provided as constants in the prompt.
Triggers
- write vba to copy row to another sheet
- fix Method or data member not found ActiveCell
- vba macro to copy selection
- copy data from reminders to events vba
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.