Skip to main content

Posts

Showing posts from December, 2024

Add Record & Save Record into another Microsoft Excel Sheet

I want macro only select that records from Sno 1 to 10 which have code and ONLY Transfer values to anther sheet in excel ? Below is a VBA macro designed to copy only the values (not formulas) from rows with a valid Code (non-empty in the "Code" column) for Sno 1 to 10 from the source sheet and paste them into the target sheet. Sub CopyValidRecords()     Dim SourceSheet As Worksheet, TargetSheet As Worksheet     Dim LastRow As Long, TargetRow As Long     Dim i As Long     ' Set worksheets     Set SourceSheet = ThisWorkbook.Sheets("Source") ' Replace "Source" with your source sheet name     Set TargetSheet = ThisWorkbook.Sheets("Target") ' Replace "Target" with your target sheet name     ' Find the next empty row in the target sheet     TargetRow = TargetSheet.Cells(TargetSheet.Rows.Count, "A").End(xlUp).Row + 1     ' Loop through Sno 1 to 10 in the source sheet     For i = 1 To 10 ...