Hello,
I am having issues copying the same thing 'n' amount of times to every 'n' row. i have a range of cells and would like to post it every over and over again (i have a code to get the respective values). I do this several different times and paste it a different amount of times. Here is the 'hard code' of what i need done:
and then here is my attempt loop it. but i keep getting errors every which way.
I am having issues copying the same thing 'n' amount of times to every 'n' row. i have a range of cells and would like to post it every over and over again (i have a code to get the respective values). I do this several different times and paste it a different amount of times. Here is the 'hard code' of what i need done:
Code:
'Count of Mode
Dim modeTable As Worksheet
Set modeTable = Sheets.Add(After:=Sheets(Worksheets.Count))
modeTable.Name = "modeTable"
TableTemplates.Range("A67:G84").Copy
modeTable.Range("A2").Select
ActiveSheet.Paste
modeTable.Range("A21").Select
ActiveSheet.Paste
modeTable.Range("A40").Select
ActiveSheet.Paste
modeTable.Range("A59").Select
ActiveSheet.Paste
modeTable.Range("A78").Select
ActiveSheet.Paste
modeTable.Range("A97").Select
ActiveSheet.Paste
modeTable.Range("A116").Select
ActiveSheet.Paste
modeTable.Range("A135").Select
ActiveSheet.Paste
modeTable.Range("A154").Select
ActiveSheet.Paste
modeTable.Range("A173").Select
ActiveSheet.Paste
modeTable.Range("A192").Select
ActiveSheet.Paste
modeTable.Range("A211").Select
ActiveSheet.Paste
modeTable.Range("A230").Select
ActiveSheet.Paste
modeTable.Range("A249").Select
ActiveSheet.Paste
and then here is my attempt loop it. but i keep getting errors every which way.
Code:
'count number of 'Count of Mode' table needed
TableNames.Select
Dim modeCount As Integer
Dim tableRowDiff As Integer
modeCount = Application.WorksheetFunction.CountIf(Range("A2:A" & lrTableNames), "Count of Mode") 'how many times i need to post a new table resides on a different spreadsheet
tableRowDiff = 19
For modeRow = 1 To modeCount
modeTable.Range("A" & (modeRow * tableRowDiff)).Select
ActiveSheet.Paste
Next modeRow