0

I'm trying to find the last row off column D, then move three up, and one to the right and insert data to that column.

The reason for this, is that the above cells are dynamic and can be deleted and added as you go along - the last cell and the cell I'm trying to target, doesn't contain the same reference (except from the last line in any column, which are always three down and one to the right from D (LastRow).

I haven't found a solution in similar posts.

The image shows the sheet.
The cells marked with yellow are the lastRow cell and the cell I'm trying to insert data into.
The cells marked with a blue ring, contains the dynamic cells, which gets longer/shorter depending on the situation.

Sheet I'm working on

Community
  • 1
  • 1
  • Take a look at [this answer](https://stackoverflow.com/a/11169920/2292722) to find the last used cell in a column. – Tom Brunberg Dec 28 '19 at 13:06
  • Thank you for the reply - Allthough i've seen the thread, but the solutions seemed complicated for what i needed (Maybe I just didn't understand them properbly) - I solved it by using the code in my comment below (Y) – MNDevelopments Dec 28 '19 at 13:33

2 Answers2

1

I ended up solving my problem with the following code:

Dim korrektion1 As Double
Private Sub CommandButton1_Click()

Range("E4").End(xlDown).Select

Selection.Offset(-3, 0).Select

Selection.Value = korrektion1

Unload UserForm2

End Sub
1

You may convert that to one line rather than multiple lines.

Dim korrektion1 As Double
Private Sub CommandButton1_Click()
Range("E4").End(xlDown).Offset(-3, 0).Value = korrektion1
Unload UserForm2
End Sub
manoj0790
  • 473
  • 4
  • 10