![]() |
|
|
|
#1
|
|||
|
|||
|
Post a copy of your workbook |
|
#2
|
|||
|
|||
|
I took a different approach and used a nested FOR loop to complete my project. I have also attached the workbook to this post so others can follow along.
Code:
Sub AssignTasks()
Dim namesRange As Range
Dim tasksRange As Range
Dim taskIndex As Integer
Dim rowIndex As Integer
Dim colIndex As Integer
Dim taskCell As Range
' Define the ranges
Set namesRange = Worksheets(1).Range("A2:A13")
Set tasksRange = Worksheets(2).Range("A1:A18")
' Initialize the task index
taskIndex = 1
' Loop through the columns (dates)
For colIndex = 2 To 11 ' B to K (2 to 11)
' Loop through the names
For Each taskCell In namesRange
' Assign task to the cell
taskCell.Offset(0, colIndex - 1).Value = tasksRange.Cells(taskIndex, 1).Value
' Update the task index
taskIndex = taskIndex + 1
' Reset the task index if it exceeds the number of tasks
If taskIndex > tasksRange.Rows.Count Then
taskIndex = 1
End If
Next taskCell
Next colIndex
End Sub
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using a macro with if statement to populate a list from one worksheet to another | clcummings | Excel | 2 | 04-10-2023 08:53 PM |
| How to populate a dropdown list with a spcific column in a specific worksheet | ericliu24 | Word VBA | 2 | 03-17-2022 05:24 AM |
How to populate a userform combobox from an excel worksheet
|
jrooney7 | Word VBA | 14 | 09-16-2018 08:52 PM |
| How do I populate Worksheets using information entirely from another Worksheet in the same Workbook? | BrieDanielle | Excel | 1 | 06-18-2016 10:50 AM |
| Userform calls other userform, then populate worksheet | Lehoi | Excel Programming | 0 | 02-03-2016 02:58 PM |