DimwsAsWorksheetSetws=Sheets("SOMESHEET")' Rename the sheetDimlastRowAsInteger' For optimisation, don't forget to change it to Byte (255), Integer (32,767) or Long (2B) depending on how many lines you haveDimlastColumnAsByte' For optimisation, don't forget to change it to Byte (255), Integer (32,767) or Long (2B) depending on how many columns you haveDimdynamicRngAsRange' Find the last non-blank cell in column A (1)lastRow=ws.Cells(ws.Rows.Count,1).End(xlUp).Row' Find the last non-blank cell in the first row (assuming data starts in row 1)' Change "A1" to where your data starts if it's differentlastColumn=ws.Cells(1,ws.Columns.Count).End(xlToLeft).Column' Define the range from A1 to the last non-blank cell in the last row and columnSetdynamicRng=ws.Range("A1").Resize(lastRow,lastColumn)