Hello there. Looking for code that will unhide row if i input data from userform. userform inputs data in (a)general and (b)date. c and d = formula. yeah, and how to autocopy this formula to next cells?
Hello there. Looking for code that will unhide row if i input data from userform. userform inputs data in (a)general and (b)date. c and d = formula. yeah, and how to autocopy this formula to next cells?
Last edited by pulss; 03-22-2016 at 10:33 AM.
Kind regards![]()
Private Sub btnADD_Click() Dim ssheet As Worksheet Dim lastrow As Long lastrow = Sheet1.Cells(Rows.Count, 2).End(xlUp).Row Set ssheet = ThisWorkbook.Sheets("SanGr") If Me.tbName = "" Then MsgBox "Ievadiet Vārdu Uzvārdu" GoTo ending Else nr = ssheet.Cells(Rows.Count, 1).End(xlUp).Row + 1 ssheet.Range("A" & nr).EntireRow.Hidden = False ssheet.Cells(nr, 1) = Me.tbName ssheet.Cells(nr, 2) = Me.tbDate 'notiiriit laukus Me.tbName = "" Me.tbDate = "" Me.tbName.SetFocus End If ending: End Sub
Leo
Sorry I forgot the formula, to let this work remove the code from textbox
Input in texbox for date can be
d-m-yy dd-mm-yyyy d/m/yy dd/mm/yyyy
output in sheet is dd/mmm/yy
Kind regards![]()
Private Sub btnADD_Click() Dim ssheet As Worksheet Dim lastrow As Long lastrow = Sheet1.Cells(Rows.Count, 2).End(xlUp).Row Set ssheet = ThisWorkbook.Sheets("SanGr") If Me.tbName = "" Then MsgBox "Ievadiet Vārdu Uzvārdu" GoTo ending Else nr = ssheet.Cells(Rows.Count, 1).End(xlUp).Row + 1 ssheet.Range("A" & nr).EntireRow.Hidden = False ssheet.Cells(nr, 1) = Me.tbName ssheet.Cells(nr, 2) = Format(Me.tbDate, "dd/mmm/yy") ssheet.Cells(nr, 3).FormulaR1C1 = "=RC[-1]-TODAY()" 'notiiriit laukus Me.tbName = "" Me.tbDate = "" Me.tbName.SetFocus End If ending: End Sub
Leos
Niice that was fast. unhide works
there is one more formula cells(nr, 4). and is there possible add code for conditional formating to entire row if it expired or expired soon?
something wrong in formula?
![]()
ssheet.Cells(nr, 4).formular1c1 = "IF(RC[-1]<0, "BEIGUSIES", IF(RC[-1]<30, "DRIZ BEIGSIES", ""))"
nevermind i fount it out
![]()
ssheet.Cells(nr, 4).FormulaR1C1 = "=IF(RC[-1]<0, ""BEIGUSIES"", IF(RC[-1]<30, ""DRIZ BEIGSIES"", """"))"
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks