I am setting up a planning workbook where my company would have individual sheets (all set the same way) planning individual projects. These sheets would have certain cells (the same on each sheet) that would then be referenced by the main master schedule, a compilation of the high points of the subproject schedules. Is this possible? I am quite new at VBA coding so please be nice :)
I currently have a bit of code written to copy and paste into the last empty cell in Column B on the target sheet, but this code doesn't work anyway (havent figured out why yet). But ideally I would like the cells to be referenced, not copy+pasted, to avoid miscommunication between sheets when things change. Code pasted below for reference, would also appreciate help fixing this in addition to the other referencing issue.
Sub LoopAndInsert()
Dim ws As Worksheet
Dim target As Worksheet
Set target = Worksheets("Global Schedule Gantt") 'sheet we're copying to
For Each ws In ThisWorkbook.Worksheets 'loop through all worksheets
If ws.Name <> target.Name Then 'if not the target sheet then...
'copy range into the next blank row in column C
ws.Range("CopyToGlobal").Copy target.Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next ws
End Sub
CopyToGlobal
? A named range or? If so how do you have it work on multiple sheets? – SimonMsgBox ws.Range("CopyToGlobal").Address
into theIf statement
, what is the result? What is not working i.e. what is the error (number, description)? – VBasic2008