0

Is it possibel to create a piece of code, where the range is set by, where there are numbers? I will try to explain what i mean.

Normally my range is fra A1 to W14, which is copied from another sheet. If row 7-14 is empty, i would like to create at range fra A1:W6 instead.

Sub FindTomogindsætdata()
Workbooks("bæreevneberegning_pælefundering_optimeret").Worksheets("Rammeliste").Select
Worksheets("Rammeliste").Range("O13:W25").Copy
Worksheets("Bæreevneberegning").Select
Range("B10000").Select
Selection.End(xlUp).Offset(1, 0).Select
ActiveCell.PasteSpecial xlPasteValues
Workbooks("bæreevneberegning_pælefundering_optimeret").Worksheets("Rammeliste").Select
Worksheets("Rammeliste").Range("AB13:AB25").Copy
Worksheets("Bæreevneberegning").Select
Range("O10000").Select
Selection.End(xlUp).Offset(1, 0).Select
ActiveCell.PasteSpecial xlPasteValues
End Sub

My problem comes from, when i insert my Range i sheet "Bæreevneberegning" for the second time, it will take the "empty" cells. So if Row 7-14 is empty, it will leave a gap.

Hope someone can help!

  • Looks like you want a way of [finding the last row](https://stackoverflow.com/questions/38882321/better-way-to-find-last-used-row) in a range. Side note: you really want to [avoid using select](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba) in your code. – cybernetic.nomad Feb 19 '20 at 20:24
  • Good to know about avoiding select - im new in this an trying to learn the does and donts – Pernille Sunds Eskildsen Feb 19 '20 at 20:28

0 Answers0