Skip to content

Instantly share code, notes, and snippets.

View tanzilhuda's full-sized avatar

Tanzil Huda tanzilhuda

View GitHub Profile
VBA Code:
Instruction:
Step-1: alt+F11
Step-2: Insert>Module
Step-3: Input/Write the Code
Step-4: Click Run Sub/UserForm (F5)
-----------------------------------
1. Rename Sheet basis of row or column name
Sub RenameSheet()
1. Age Calculator: =DATEDIF(M2,TODAY(),"Y") & " Years, " & DATEDIF(M2,TODAY(),"YM") & " Months, " & DATEDIF(M2,TODAY(),"MD") & " Days"
=DATEDIF(M2,N2,"YM") & " Months, " & DATEDIF(M2,N2,"MD") & " Days"
Only Month
=DATEDIF(A2,B2,"M") [1st is small, 2nd is large Date]
Only Year
=DATEDIF(A2,B2,"Y") [1st is small, 2nd is large Date]
2. Count:
a. Counting Specific name: =COUNTIF(F2:F10, "MISSED")
@tanzilhuda
tanzilhuda / gist:dc81359e726ca341a17feaae18747ada
Created August 5, 2020 20:22
Rename Sheet basis of row or column name
Sub RenameSheet()
Dim rs As Worksheet
For Each rs In Sheets
rs.Name = rs.Range("B2")
Next rs
End Sub
@tanzilhuda
tanzilhuda / gist:26143983d103bfc32b0d47cdda0e6b4b
Created August 4, 2020 21:47
Delete same rows across multiple sheets In Excel
Sub bleh()
Dim xWs As Worksheet
Set xWs = ActiveSheet
ThisWorkbook.Worksheets.Select
Rows("10:20").Select
Selection.Delete
xWs.Select
End Sub
==========================
--------Ascending---------
==========================
Sub SortSheets1()
Dim I As Integer
Dim J As Integer
For I = 1 To Sheets.Count - 1
For J = I + 1 To Sheets.Count
If UCase(Sheets(I).Name) > UCase(Sheets(J).Name) Then
@tanzilhuda
tanzilhuda / gist:eb36f780d53e1f74451e384e26c022e2
Last active August 3, 2020 15:18
Combine Multiple Excel Spreadsheet into One Excel File
Sub GetSheets()
'Update ExcelJunction.com
Path = ""
Filename = Dir(Path & "*.xls")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
@tanzilhuda
tanzilhuda / Delete Button Warning
Last active May 6, 2018 19:06
Delete Button Warning
onclick="return confirm('are you sure to delete!')"
For Bootbox js
==============
CND:
https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js
html:
id="delete"
Example:
<a id="delete" href="#"><button class="btn btn-outline-danger">Delete</button></a>
@tanzilhuda
tanzilhuda / https and remove index.php
Last active December 9, 2017 08:21
remove index.php and https setup
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.php($|\ |\?)
RewriteRule ^ /%1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
config.php
------------
<?php
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASS", "");
define("DB_NAME", "your_db_name");
?>