berserkdude
New Member
- Joined
- Mar 4, 2016
- Messages
- 5
Hello.
Putting it in simple terms: I am looking for a code that puts the text from cell c3 into a range of cells from c5:c75.
For example in range(c5:c75), if the cells c5 and c6 already have text, I would want to fill the cell c7 with my text. Another example is: if cells c5 and c7 have text but cell c6 doesn't have any text, I would like my text to go there.
Right now my code does not seems ideal, but it goes like this:
Sub check text()
'In range A1: =Countif(c5:c75;"<>"&"")
If Range("A1") = "0" Then
Range("c5") = Range("c3")
ElseIf Range("A1") = "1" Then
Range("c6") = Range("C3" )
ElseIf Range("A1") = "2" Then
Range("C7") = Range("c3")
'And it keeps going until:
ElseIf Range("A1") = "74" then
Range("c75") = Range("c3")
ElseIf Range("A1") = "75" then
Msgbox("range is full")
End if
The problem is the massive size of it, and for it stops working if I have a empty cell between cells with text. For example, if cell c5 has text, cell c6 is empty and cell c7 has text. The code wont work.
Thanks for the time
Putting it in simple terms: I am looking for a code that puts the text from cell c3 into a range of cells from c5:c75.
For example in range(c5:c75), if the cells c5 and c6 already have text, I would want to fill the cell c7 with my text. Another example is: if cells c5 and c7 have text but cell c6 doesn't have any text, I would like my text to go there.
Right now my code does not seems ideal, but it goes like this:
Sub check text()
'In range A1: =Countif(c5:c75;"<>"&"")
If Range("A1") = "0" Then
Range("c5") = Range("c3")
ElseIf Range("A1") = "1" Then
Range("c6") = Range("C3" )
ElseIf Range("A1") = "2" Then
Range("C7") = Range("c3")
'And it keeps going until:
ElseIf Range("A1") = "74" then
Range("c75") = Range("c3")
ElseIf Range("A1") = "75" then
Msgbox("range is full")
End if
The problem is the massive size of it, and for it stops working if I have a empty cell between cells with text. For example, if cell c5 has text, cell c6 is empty and cell c7 has text. The code wont work.
Thanks for the time