Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-16-2024, 06:17 AM
Logit Logit is offline Copy Paste Rows Windows 10 Copy Paste Rows Office 2007
Expert
Copy Paste Rows
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default Copy Paste Rows

Cross posted at : Copy Paste Rows


My project requires copying rows with CheckBoxes marked as TRUE beginning at row 11 and down to rows used. Then pasting those rows
to a second sheet, beginning at row 1 in Column A.

Here is my attempt at doing so. The issue I am running into is getting the macro to identify the first row with a "True" checkbox in Column E.
I don't know if the copy/paste will function as desired as my current macro doesn't do anything. No errors / no remarks ... it just quickly goes
through whatever motions it is going through, stops but nothing is copied or pasted.

Thank you for your assistance.



Code:
Copy to clipboard
Sub CopyRows()
Dim chkbx As CheckBox
Dim r As Long
Dim LRow As Long


For Each chkbx In ActiveSheet.CheckBoxes
    If chkbx.Value = 1 Then
        For r = 1 To Rows.Count
            If Cells(r, 6).Top = chkbx.Top Then
                With Worksheets("Sheet2")
                    LRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
                    .Range("A" & LRow & ":D" & LRow) = _
                    Worksheets("Sheet1").Range("E" & r & ":J" & r).Value
                End With
                Exit For
            End If
        Next r
    End If
Next

End Sub
Here is the range affected with the above macro (attached).

Workbook file is attached as well.
Attached Images
File Type: jpg Copy Paste.jpg (51.5 KB, 11 views)
Attached Files
File Type: xlsm Copy Paste.xlsm (21.0 KB, 2 views)
Reply With Quote
  #2  
Old 10-16-2024, 03:59 PM
Logit Logit is offline Copy Paste Rows Windows 10 Copy Paste Rows Office 2007
Expert
Copy Paste Rows
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

I've done considerable research concerning this issue. Apparently VBA isn't designed to copy CheckBoxes. VBA can copy a simple character "X" that is placed in a cell.

So ... the textboxes must go !

Thanks for looking !
Reply With Quote
  #3  
Old 10-16-2024, 10:39 PM
ArviLaanemets ArviLaanemets is offline Copy Paste Rows Windows 8 Copy Paste Rows Office 2016
Expert
 
Join Date: May 2017
Posts: 932
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

Use Data Validation Lists for cells instead of checkbox controls. E.g. using "X" (or TRUE, or whatever) as a single list value, so user can't enter anything different.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Paste Rows Copy and Paste certain columns from selected rows. 14spar15 Excel Programming 2 05-18-2023 07:57 AM
Copy Paste Rows Is it possible to copy non-contiguous rows of a Table and paste them as a separate Table in Word? Joey Cheung Word Tables 1 08-12-2014 05:15 PM
how can i split a column of rows in half without copy and paste.. Lindseyfparker Excel 2 04-25-2014 12:52 AM
Copy Paste Rows Find specific rows then copy and paste to new doc konopca Word VBA 5 02-20-2014 02:34 PM
Why cant I just copy/paste new flippin rows into a flippin table? jethrouk Word 8 11-17-2013 06:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft