VBA Copy and paste range to next empty cell(s) to right
Closed
micksv
Posts
2
Registration date
Sunday July 26, 2015
Status
Member
Last seen
July 26, 2015
-
Jul 26, 2015 at 04:42 PM
micksv Posts 2 Registration date Sunday July 26, 2015 Status Member Last seen July 26, 2015 - Jul 26, 2015 at 11:01 PM
micksv Posts 2 Registration date Sunday July 26, 2015 Status Member Last seen July 26, 2015 - Jul 26, 2015 at 11:01 PM
Related:
- Vba to copy and paste a range multiple times based on cell value
- Vba case like - Guide
- If a cell has text then return value ✓ - Excel Forum
- How to delete multiple files on mac - Guide
- You've tried to log in too many times. to protect your account, a temporary block has been placed on logging in. please try again later. ✓ - Facebook Forum
- Times attack - Download - Children
1 response
micksv
Posts
2
Registration date
Sunday July 26, 2015
Status
Member
Last seen
July 26, 2015
1
Jul 26, 2015 at 11:01 PM
Jul 26, 2015 at 11:01 PM
I fixed it! Here is the working macro:
Sub Calculate()
'
' Calculate Macro
'
Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long
Set source = Sheets("Test Cart")
Set destination = Sheets("Calculations")
'find empty Column (actually cell in Row 4)'
emptyColumn = destination.Cells(4, destination.Columns.Count).End(xlToLeft).Column
If emptyColumn > 1 Then
emptyColumn = emptyColumn + 1
End If
Sheets("Test Cart").Range("F4:F11").Copy
Sheets("Calculations").Cells(4, emptyColumn).PasteSpecial Paste:=xlPasteValues
End Sub
Thanks.
Sub Calculate()
'
' Calculate Macro
'
Dim source As Worksheet
Dim destination As Worksheet
Dim emptyColumn As Long
Set source = Sheets("Test Cart")
Set destination = Sheets("Calculations")
'find empty Column (actually cell in Row 4)'
emptyColumn = destination.Cells(4, destination.Columns.Count).End(xlToLeft).Column
If emptyColumn > 1 Then
emptyColumn = emptyColumn + 1
End If
Sheets("Test Cart").Range("F4:F11").Copy
Sheets("Calculations").Cells(4, emptyColumn).PasteSpecial Paste:=xlPasteValues
End Sub
Thanks.