brendaattale
New Member
- Joined
- Dec 10, 2018
- Messages
- 5
Hello there,
I'm trying to write a code with a format in it but it doesn't seem to work properly. Anyone can help re-write or write it properly with a clean way please? The whole VBA without the whole procedure written is also included. Thank you very much.
I'm trying to write a code with a format in it but it doesn't seem to work properly. Anyone can help re-write or write it properly with a clean way please? The whole VBA without the whole procedure written is also included. Thank you very much.
Me("STM" & Format(CStr(1+(q * 2)), "00"))
VBA Code:
For i = 1 To 12
For q = 4 To 15
With Me.Controls("STB" & i)
If .Value Then
If Trim(Me("STM" & Format(CStr(1 + (q * 2))), "00")) <> "" Then
With Sheets("Inv_doc")
'Commands for the sheet
With .Range("A17").CurrentRegion
'Commands for the table
'...
'Data transfer to the table
j = j + 1
With .Rows(.Rows.Count).Offset(1)
.Cells(1).Value = "Item " & Format(j, "00") 'Me.Controls("Textbox" & CStr(i)).Name
.Cells(2).MergeArea.Cells(1).Value = "Rebate for " & Me("STM" & Format(CStr((q * 2)), "00"))
If staWks.Range("P5").Value = "Full" Then
.Cells(11).Value = CDec(Me("STM" & Format(CStr(1 + (q * 2)), "00")))
ElseIf staWks.Range("P5").Value = "Shared" Then
.Cells(11).Value = 2 * CDec(Me("STM" & Format(CStr(1 + (q * 2)), "00"))) 'Shared (2Buy2 standard framework)
Else
.Cells(11).Value = 1 * CDec(Format(Me.Controls("STM" & CStr(1 + (q * 2))), "00").ValueMe("STM" & Format(CStr(1 + (q * 2)), "00"))) 'Shared + (2Buy2 new framework)
End If
End With
End With
End With
End If
.Value = False
End If
End With
Next q
Next i