what am doing wrong?

ageordieinneed

New Member
Joined
Jun 20, 2019
Messages
21
hi all been awhile since been on here so be kind,
making darts scorer but my code is debugging trying to copy input from h14 and pasting it to w6:w4 then down the column next empty cell down,so every time you input a value it goes down the column and the same with p14 y6:y34 ?
the code is
Sub Macro2()
'
' Macro2 Macro
'

'
Range("H14:J16").Select
Selection.Copy
Range("W6").Select
ActiveSheet.Paste
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.UnMerge
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("w6:w34" & Rows.Count).End(xlUp).Offset(1).Select

End Sub

hope this helps
cheers
 

Attachments

  • 10-04-2023 18-23-56.png
    10-04-2023 18-23-56.png
    8.9 KB · Views: 21

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Just for the error on line
Rich (BB code):
Range("w6:w34" & Rows.Count).End(xlUp).Offset(1).Select
the line should be
VBA Code:
Range("w6:w" & Rows.Count).End(xlUp).Offset(1).Select
if you want the whole range selected
Edit: If you just want the next empty cell selected see the next post by @bebo021999 or use
VBA Code:
Range("W" & Rows.Count).End(xlUp).Offset(1).Select
If you want to keep the Range(......) syntax
 
Last edited:
Upvote 0
PHP:
Range("w6:w34" & Rows.Count).End(xlUp).Offset(1).Select
should be

PHP:
Cells(Rows.Count,"W").End(xlUp).Offset(1).Select
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top