Tuesday, March 28, 2023

Google Sheets Automation - Auto Email On Basis Of Cell Value

 Google Sheets Automation - Auto Email On Basis Of Cell Value




Copy below Code and paste under apps script (Change the email id to required)



function sendEmail() {
  var sheet = SpreadsheetApp.getActive().getSheetByName("Sheet1"); // Replace "Sheet1" with the name of your sheet
  var range = sheet.getRange("C:C"); // Replace "C:C" with the range of your column
  var values = range.getValues();
  var lastRow = sheet.getLastRow();
  var emailSent = sheet.getRange("E1:E").getValues(); // Assuming E2 is the starting cell of the emailSent column

  for (var i = 0; i < lastRow; i++) {
    if (values[i][0] === 0 && emailSent[i][0] !== "SENT") { // Change "0" to the value you want to monitor and adjust emailSent accordingly
      var emailAddress = "dummy@excelmind.com"; // Replace with the email address you want to send the notification to
      var subject = "Stock count went to zero";
      var message = "Stock went zero for: " + sheet.getRange("I2").getValue(); // Replace "D1" with the cell you want to include in the email body
      
      MailApp.sendEmail(emailAddress, subject, message);
      sheet.getRange("E" + (i + 1)).setValue("SENT"); // Assuming E2 is the starting cell of the emailSent column


      }
  }
}

Thursday, March 16, 2023

Stock Inventory Tracker In Excel - Auto Email

 Stock Inventory Tracker In Excel - Auto Email



Note: Save File under excel format and makesure outlook installed and correctly configured


Copy Code and paste under Inventory/Sheet Sheet

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim myRange As Range
    Dim myCell As Range
    Dim mySubject As String
    Dim myMessage As String
    Dim myMail As Object
    
    Set myRange = Range("E:E")
    
    If Not Intersect(Target, myRange) Is Nothing Then
        For Each myCell In Intersect(Target, myRange)
            If myCell.Value = 0 Then
                Set myMail = CreateObject("Outlook.Application").CreateItem(0)
                mySubject = "Stock count has gone to zero"
                myMessage = "The stock count for " & Cells(1, 16).Value & " has gone to zero."
                With myMail
                    .To = Cells(2, 8).Value
                    .Subject = mySubject
                    .Body = myMessage
                    .Send
                End With
            End If
        Next myCell
    End If
End Sub


Thursday, December 22, 2022

Tuesday, December 13, 2022

Excel Mind - Auto Create & Rename Multiple Sheets With Just A Click

 Auto Create & Rename Multiple Sheets With Just A Click





Click here for sample File (Download and open in msexcel as it will not work in google sheets)

Copy Below Code and paste it under module:


Sub InsertMultipleSheets()

Dim x As String

Dim ShCnt As Integer

Dim myarray() As String

Dim i As Integer

Dim Lrow As Integer


x = InputBox("Enter number of sheets to insert.", "Enter Multiple Sheets")


If x = NullString Then


Exit Sub


End If


Sheets.Add After:=ActiveSheet, Count:=x


Sheets("Main").Select

Range("A1").Select


Lrow = Range("A1").End(xlDown).Row

ShCnt = ThisWorkbook.Sheets.Count

ReDim myarray(1 To Lrow)

For i = 1 To UBound(myarray)

myarray(i) = Range("A" & i).Value

Next i

For i = 1 To ShCnt

Sheets(i).Name = myarray(i)

Next i

MsgBox "Sheets created and renamed successfully"


End Sub


Saturday, November 26, 2022

Create Userform In Excel With & Without VBA


VBA Code for Submit Button:

Private Sub CommandButton1_Click()

Dim Lastrow As Integer

Lastrow = Sheets("VBA").UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1

'Transfee data to VBA Sheet

Sheets("VBA").Cells(Lastrow, 1) = TextBox1.Text
Sheets("VBA").Cells(Lastrow, 2) = TextBox2.Text
Sheets("VBA").Cells(Lastrow, 3) = TextBox3.Text
Sheets("VBA").Cells(Lastrow, 4) = TextBox4.Text
Sheets("VBA").Cells(Lastrow, 5) = Now

'clear Data

Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = vbFormControlMenu Then

Cancel = True
MsgBox "Please use the close button to close the form", vbOKOnly

End If

End Sub


VBA Code for Cancel Button:

Private Sub CommandButton2_Click()

Unload UserForm1

End Sub

Tuesday, October 25, 2022

Auto Format Row & Coloumn Colour with Mouse Click In Excel

Tutorial on auto format of complete row and column colour of cell which we click.


We have explain the each step in very easiest way including how to activate developer tab in microsoft excel, we have also added VBA code below which can be just copied and pasted.


Copy the code from below and paste it under sheet which hold data:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Application.CutCopyMode = False Then

Application.Calculate

End If

End Sub


Formula for Coloumn: =COLUMN()=CELL("col") Formula for Row: =CELL("row")=ROW()


To download sample file ➡ Click Here  (Download the file and open in excel to make it work)


Sunday, October 23, 2022

MS EXCEL - SPEEDOMETER CHART TUTORIAL

SPEEDMETER CHART FOR DYNAMIC INTERACTIVE DASHBOARD IN EXCEL


Blog coming soon, mean while checkout our new tutorial under below video and to download sample file: ➡ Click Here 

Note: Download the file and open in EXCEL to use the chart





How To Use Vlookup In Merged Cells

  How To Use Vlookup In Merged Cells Click Here to download sample file for practice Note: Download the file and open with microsoft excel