Hi everybody, I am trying to learn Excel VBA on my own and I am a beginner. So I have a quick question.
I want to go to next empty cell of column F and insert the value of A8. In this case value of the red cell (F9) should be "111" and value of the green cell (H15) "222" and finally for the blue cell value should be "333". This table is dynamic, meaning total number of "111", "222", "333" etc. may change.
How can I do that with using variables and loop?
I couldn't do much but here is my code. As you can see value entered manually and there is no loop. I need to assign a variable for value which is equal to Row-1 of the colored cells and of course it should be done in loop. Running macros for each empty cells might be a bad idea ?
Consider following screenshot.
I want to go to next empty cell of column F and insert the value of A8. In this case value of the red cell (F9) should be "111" and value of the green cell (H15) "222" and finally for the blue cell value should be "333". This table is dynamic, meaning total number of "111", "222", "333" etc. may change.
How can I do that with using variables and loop?
I couldn't do much but here is my code. As you can see value entered manually and there is no loop. I need to assign a variable for value which is equal to Row-1 of the colored cells and of course it should be done in loop. Running macros for each empty cells might be a bad idea ?
VBA Code:
Dim NextEmptyCell as Long
NextEmptyCell = .Cells(Rows.Count, "F".End(xlUp).Row + 2
Range("F1:F" & NextEmptyCell).Find("").Value = "111"
Consider following screenshot.