328iXdrive
New Member
- Joined
- Sep 30, 2016
- Messages
- 3
Hey Folks!
I'm trying to select and then copy cells within a range if a there is data in a specific column. If there is, I need it to copy all those cells in that row range even if it has some blanks in other cells in that range. I was trying this:
But it tells me I get Run-time error 1004: Command cannot be used on multiple selections.
I know that the problem is that it is deselecting blank cells within that range, however I need it to only deselect anything in column D is blank (and then from there select only the visible cells), so it is trying to not copy the blank cells in that range even if there is value in column D and it is not hidden. I've checked many other threads but I can't find a problem quite like this one. A lot of them get into selecting visible cells, but none of them get into how to copy if both conditions are met, visible cells AND not blank in a certain column (but other blanks in other columns on that row are OK and should be copied).
Any help is MUCH appreciated!
I'm trying to select and then copy cells within a range if a there is data in a specific column. If there is, I need it to copy all those cells in that row range even if it has some blanks in other cells in that range. I was trying this:
Code:
Sub CopyPt6()
If ActiveCell = "" Then
Selection.Copy
ElseIf ActiveCell.Value <> "" Then
Range("D2:O500").Select
Selection.SpecialCells(xlCellTypeConstants).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
End If
End Sub
But it tells me I get Run-time error 1004: Command cannot be used on multiple selections.
I know that the problem is that it is deselecting blank cells within that range, however I need it to only deselect anything in column D is blank (and then from there select only the visible cells), so it is trying to not copy the blank cells in that range even if there is value in column D and it is not hidden. I've checked many other threads but I can't find a problem quite like this one. A lot of them get into selecting visible cells, but none of them get into how to copy if both conditions are met, visible cells AND not blank in a certain column (but other blanks in other columns on that row are OK and should be copied).
Any help is MUCH appreciated!