Next Blank Cell

leeksleeks

Board Regular
Joined
Oct 31, 2013
Messages
96
Hi,

I currently have a sports results worksheet that searches through the results and pastes them into a worksheet with the same name (first 3 letters of the team). However i would now like it to paste these results in the next available blank cell on each worksheet and not always in Cell A3. Whilst I know what part of the code sends it to cell A3, I don't know how to make it so that the results are updated in the next blank cell. This was a code that was written by an ex work colleague of mine that I dont fully understand so if someone can please explain the procedures it is running through and how I could change it that would be great. Here is the code:

Dim home As String
Dim away As String
Dim name As String
Dim index As Integer

For k = 2 To 13 'number of teams worksheets

index = 0

For i = 1 To 500

home = Trim(Cells(i, 2).Value)
away = Trim(Cells(i, 4).Value)
name = Trim(Sheets(k).name)

If home = name Or away = name Then
For j = 1 To 5
Sheets(k).Cells(3 + index, j) = Cells(i, j)
Next j
index = index + 1
End If

Next i

Next k

End Sub

Any help would be greatly appreciated.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I'm sorry, but I can not understand your goal, cann you paste here a link to a sample file ?
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,842
Members
449,471
Latest member
lachbee

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