Change to a VBA code

Marvo

Board Regular
Joined
Nov 27, 2023
Messages
227
Office Version
  1. 2021
Platform
  1. Windows
I have the following code in a workbook. When pressing "update" the data entered should populate rows on a another sheet to adjacent cells, as in columns E, F, G etc but instead populates E, G, I, etc, missing alternate columns out. Can anybody tell me where in the code its going wrong please? (I've little knowledge working with VBA. Thank you.

Sub Master_Update()
Dim a, b
Dim i As Long, irow As Long
Dim player As String
Application.ScreenUpdating = False

player = Range("Player")
a = Range("Shots")
ReDim b(1 To 18)

With Sheets("Master")
.Activate
irow = Application.Match(player, Range("B:B"), 0)
For i = 1 To 18
.Cells(irow, (i - 1) * 2 + 5) = a(i, 1)
b(i) = .Cells(irow, i + 61)
Next i
End With

With Sheets("Score Enter")
.Cells(3, "C").Resize(18, 1) = Application.Transpose(b)
.Activate
End With

Application.ScreenUpdating = True

End Sub
Sub Clear_Shots()
Range("Shots").ClearContents
Range("Points").ClearContents
End Sub
 
Okay. I'll mark this as solved, then start a new thread when I have a bit more time.
We don't have a 'Solved' option on threads in our forums.
Also, if the question is really the same as, or a continuation of, this one please do not start a new thread but continue in this one per #12 of the Forum Rules
 
Upvote 0
start a new thread when I have a bit more time
And attach/share a file example to make it easier for yourself and those helping. Without seeing what and where from somehow...
 
Upvote 0
I'll do my best when I return. Its a big workbook. I tried to put in on OneDrive to share earlier but I couldn't get that to work either. I'll be back this afternoon. Thank you.
 
Upvote 0
So you enter the player (from drop down list) scores on the "score enter sheet", which when update is pressed transfers to the Master Sheet where it works out the points scored, then this is transferred back to the score enter sheet. You can see this work on the original workbook.
 
Upvote 0
You have not provided access to the files on your links. Access is denied. We cannot view them.
 
Upvote 0
It's okay, I'm all good now. Job done. Got sent a completely different code that does the job. Thanks everybody and sorry if I wasted anybody's time.
 
Upvote 0

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