I need help in looping the code below trough my named range or just skip blank rows. Below code works fine until it should skip rows which should not contain textbox value.
My textboxes for this code starts at 58 and runs trough 66. But the value from theese textboxes should be pasted to cells D8:18 where C14 and C15 are empty and should be skipped. Notice that the empty cells are in C8:C18 but the value should be pasted in D8:18.
Im planning on expanding this code for about 150 textboxes so writing them all out is not an option. Do anybody know a solution, it could be to skip blank rows in the range or use a named range wich i couldnt get to work.
Any help is appreaciated
Basically this checks for input in textbox, if empty then nothing happens when I press on the "save button". Otherwise the textbox value are pasted to the specified range in my spreadsheet.
The "RR2 - 50" refers to column D and row "RR2=58-(50)=8" D8
But when some cell in C8:C18 is empty i would like the textbox value to skip that row and try the next row in that range and when not empty, paste the value in range D8:D18.
It works fine until D13 but then theres no value in B14 and B15 but below code doesnt recognize that and keeps pasting textbox value in row 14 and 15 isntead of skipping these and pasting in 16-18
Code:
Dim RR2 As Integer
For RR2 = 58 To 66
If Controls("TextBox" & RR2).Value = "" Then
Else
Worksheets("Rabattsatser").Range("D" & RR2 - 50).Value = Controls("TextBox" & RR2).Value
End If
Next RR2
My textboxes for this code starts at 58 and runs trough 66. But the value from theese textboxes should be pasted to cells D8:18 where C14 and C15 are empty and should be skipped. Notice that the empty cells are in C8:C18 but the value should be pasted in D8:18.
Im planning on expanding this code for about 150 textboxes so writing them all out is not an option. Do anybody know a solution, it could be to skip blank rows in the range or use a named range wich i couldnt get to work.
Any help is appreaciated
Basically this checks for input in textbox, if empty then nothing happens when I press on the "save button". Otherwise the textbox value are pasted to the specified range in my spreadsheet.
The "RR2 - 50" refers to column D and row "RR2=58-(50)=8" D8
But when some cell in C8:C18 is empty i would like the textbox value to skip that row and try the next row in that range and when not empty, paste the value in range D8:D18.
It works fine until D13 but then theres no value in B14 and B15 but below code doesnt recognize that and keeps pasting textbox value in row 14 and 15 isntead of skipping these and pasting in 16-18
Code:
Dim RR2 As Integer
For RR2 = 58 To 66
If Controls("TextBox" & RR2).Value = "" Then
Else
Worksheets("Rabattsatser").Range("D" & RR2 - 50).Value = Controls("TextBox" & RR2).Value
End If
Next RR2