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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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