AutoSkill 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.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8/vba-macro-for-safe-row-copying" ~/.claude/skills/ecnu-icalk-autoskill-vba-macro-for-safe-row-copying && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8/vba-macro-for-safe-row-copying/SKILL.mdsource content
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
to identify the active row. Do NOT useApplication.Selection
,Worksheet.ActiveCell
, orWorksheet.Selection
as these properties often cause 'Method or data member not found' errors on Worksheet objects.Worksheet.ActiveWindow.Selection - Variable Declaration: Explicitly declare all variables (e.g.,
,Dim currentRow As Long
) before assignment to avoid compile errors.Dim wsSource As Worksheet - 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
and paste the mapped values there.Cells(Rows.Count, "[Column]").End(xlUp).Row + 1
Anti-Patterns
- Do not use
on a Worksheet variable (e.g.,ActiveCell
).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