VBA for daily Trakker

Mumgirl

New Member
Joined
Jan 7, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi All,



Wish you all, Happy new year, Hope you are doing good !!!

I am new on MrExcel Forum, looking for VBA for few tasks

First Task – One-time activity

I am preparing the workforce daily tracking sheet for all our partners, we will send this file by mail to the partners.

Once they open this file, they will fill details in Starting B1 to B4, there is one filed “Pin to Transfer Data” A5, here they will put their desired pin – will explain this bit letter

Starting B7 to B26 they will write Technician Name, I want to have a macro to create (Add) sheets based on a list provided in B7:B26.

I want to prevent macro in duplicating sheet however user can add technician name to list and macro should be able to create sheet based on newly added name in range B7:B26

Once a sheet is created, I want to copy mater data format from a sheet called hidden – this data should come with formatting and all data validations

In home tab apart from A1:E30 Rest cells should be protected with Password ( Password=1234)

Daily Monitoring Format.xlsb
ABCDE
1RegionNorth
2BranchCalcutta
3ASC NameKaka Electronics
4GCS CodeG2345562
5Pin to Transfer Data
6T#Name
7T1
8T2
9T3
10T4
11T5
12T6
13T7
14T8
15T9
16T10
17T11
18T12
19T13
20T14
21T15
22T16
23T17
24T18
25T19
26T20
27
28
29
Home
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B6:B26Cell ValueduplicatestextNO
Cells with Data Validation
CellAllowCriteria
B1ListEast,North,South,West
B2ListAhmedabad,Bangalore,Bhubaneswar,Calcutta,Chandigarh,Chennai,Delhi,Ghaziabad,Guwahati,Hyderabad,Indore,Jaipur,Kochi,Lucknow,Mumbai,Pune


Second Task
Once Technician sheets are created, the user will fill the required details in each technician list on daily basis.

I want to have a macro button on each sheet by clicking this button macro to ask to enter “Pin to Transfer Data” using input box and match input data with cell B5 in Home tab, this is just to prevent accidental transfer of data

If the input value is matching with B5 copy date dynamically ( sheet may have less data – macro to check data Cell B2 to last filled row and copy ) and paste it in “ASC Summary” sheet in column E Date, if not matching show massage, “Please enter correct code”,

Macro to append data on each transfer.

The region, Branch, GCS code, Technician Name data is not available in Technician sheet, macro to take input of Region, Branch, GCS code from Home tab and technician name from sheet name from where data was transferred. Macro to match Row with data copied from sheet to avoid any mismatch.



I don’t know how difficult this activity but am looking forward for support from experts.

Thanks
MumGirl
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi MumGirl,

The bellow code should get you started
It takes all the entered cells in home B7:B26 and creates sheets with the cell value as the sheet name, but ignores duplicates
Then if it creates a sheet it copies and pastes the whole hidden sheet to the newly created sheet

VBA Code:
Sub addSheets()

For Each cell In ThisWorkbook.Sheets("Home").Range("B7:B26").Cells
    If cell <> "" Then
        If DuplicateSheet(cell.Value) = False Then
            ThisWorkbook.Worksheets.Add
            ActiveSheet.Name = cell.Value
            ThisWorkbook.Sheets("Hidden").Cells.Copy ActiveSheet.Cells
        End If
    End If
Next cell

End Sub

Function DuplicateSheet(SheetName As String) As Boolean
    DuplicateSheet = False
    For Each sheet In ThisWorkbook.Sheets
        If sheet.Name = SheetName Then
            DuplicateSheet = True
            Exit For
        End If
    Next sheet
End Function
 
Upvote 0
Hi MumGirl,

The bellow code should get you started
It takes all the entered cells in home B7:B26 and creates sheets with the cell value as the sheet name, but ignores duplicates
Then if it creates a sheet it copies and pastes the whole hidden sheet to the newly created sheet

VBA Code:
Sub addSheets()

For Each cell In ThisWorkbook.Sheets("Home").Range("B7:B26").Cells
    If cell <> "" Then
        If DuplicateSheet(cell.Value) = False Then
            ThisWorkbook.Worksheets.Add
            ActiveSheet.Name = cell.Value
            ThisWorkbook.Sheets("Hidden").Cells.Copy ActiveSheet.Cells
        End If
    End If
Next cell

End Sub

Function DuplicateSheet(SheetName As String) As Boolean
    DuplicateSheet = False
    For Each sheet In ThisWorkbook.Sheets
        If sheet.Name = SheetName Then
            DuplicateSheet = True
            Exit For
        End If
    Next sheet
End Function
Thanks a lot, EFANYoutube, this code is working fine for my first task.

Could you please help me in the second task as well, if not complete at least we can fulfil part of it, I know matching Pin will be a difficult task but is it possible to create code for a copy from the created sheet and append in ASC summary sheet.

Thanks & Regards.
 
Upvote 0
Hi All,



Wish you all, Happy new year, Hope you are doing good !!!

I am new on MrExcel Forum, looking for VBA for few tasks

First Task – One-time activity

I am preparing the workforce daily tracking sheet for all our partners, we will send this file by mail to the partners.

Once they open this file, they will fill details in Starting B1 to B4, there is one filed “Pin to Transfer Data” A5, here they will put their desired pin – will explain this bit letter

Starting B7 to B26 they will write Technician Name, I want to have a macro to create (Add) sheets based on a list provided in B7:B26.

I want to prevent macro in duplicating sheet however user can add technician name to list and macro should be able to create sheet based on newly added name in range B7:B26

Once a sheet is created, I want to copy mater data format from a sheet called hidden – this data should come with formatting and all data validations

In home tab apart from A1:E30 Rest cells should be protected with Password ( Password=1234)

Daily Monitoring Format.xlsb
ABCDE
1RegionNorth
2BranchCalcutta
3ASC NameKaka Electronics
4GCS CodeG2345562
5Pin to Transfer Data
6T#Name
7T1
8T2
9T3
10T4
11T5
12T6
13T7
14T8
15T9
16T10
17T11
18T12
19T13
20T14
21T15
22T16
23T17
24T18
25T19
26T20
27
28
29
Home
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B6:B26Cell ValueduplicatestextNO
Cells with Data Validation
CellAllowCriteria
B1ListEast,North,South,West
B2ListAhmedabad,Bangalore,Bhubaneswar,Calcutta,Chandigarh,Chennai,Delhi,Ghaziabad,Guwahati,Hyderabad,Indore,Jaipur,Kochi,Lucknow,Mumbai,Pune


Second Task
Once Technician sheets are created, the user will fill the required details in each technician list on daily basis.

I want to have a macro button on each sheet by clicking this button macro to ask to enter “Pin to Transfer Data” using input box and match input data with cell B5 in Home tab, this is just to prevent accidental transfer of data

If the input value is matching with B5 copy date dynamically ( sheet may have less data – macro to check data Cell B2 to last filled row and copy ) and paste it in “ASC Summary” sheet in column E Date, if not matching show massage, “Please enter correct code”,

Macro to append data on each transfer.

The region, Branch, GCS code, Technician Name data is not available in Technician sheet, macro to take input of Region, Branch, GCS code from Home tab and technician name from sheet name from where data was transferred. Macro to match Row with data copied from sheet to avoid any mismatch.



I don’t know how difficult this activity but am looking forward for support from experts.

Thanks
MumGirl
Hi All,

I have got code for the first task from EFANYoutube, however second task is equally important.

I know my expectations are very high however I come to know a few formulas which can help, you also can suggest in case of any useful formula to make this simple.

My submission is if it is difficult to collect details from the home tab using code we can use if condition, below is sample.

Sharing my origional requirement again to make it simple

Second Task
Once Technician sheets are created, the user will fill the required details in each technician list on daily basis.

I want to have a macro button on each sheet by clicking this button macro to ask to enter “Pin to Transfer Data” using input box and match input data with cell B5 in Home tab, this is just to prevent accidental transfer of data, ( if it is difficult at least we can have prompt "Are you sure to transfer this data to ASC summary sheet" to avoid an accidental transfer.)

If the input value is matching with B5 copy date dynamically ( sheet may have less data – macro to check data Cell B2 to last filled row and copy ) and paste (Append) it in “ASC Summary” sheet in column E Date, if entered code is not matching with B5 show massage prompt should appear, “Please enter correct code”,

Macro to append data on each transfer.

The region, Branch, GCS code, Technician Name data is not available in Technician sheet, macro to take input of Region, Branch, GCS code from Home tab and technician name from sheet name from where data was transferred. Macro to match Row with data copied from sheet to avoid any mismatch.

I know its very difficult task but at least help me with code with possible functionalities.

Daily Monitoring Format.xlsb
ABCDEFGHIJKLMNOPQRSTUVW
1To get filled from Home TabFill based on Sheet name from where data is copied
2RegionBranchGCS CodeTechnician NameDateWork order NoW/o DateCustomer NameAreaModel NoSerial NumberDOPWarranty StatusPart CodePart QtyAppointment StatusAppointment TimeStatus of callType of callAmount CollectedHappy Call StatusHappy Call DateRemarks
3NorthChandigarhKaka Electronics07-01-2160-1444266288607-01-21Aniruth Abhinandana BhattacharyyaThiruvananthapuramHL1643/00HL099999999999907-01-21Stock Set9965100765811Yes3:30 PMSolved₹ 750.00Not Done07-01-21Customer out of station
4NorthChandigarhKaka Electronics07-01-2160-1444266288607-01-21ThiruvananthapuramHL1643/00HL099999999999907-01-21EWNot AttendedDone
5   
6   
7   
8   
9   
10   
11   
12   
ASC Summary
Cell Formulas
RangeFormula
A3:A12A3=IF(E3>0,Home!$B$1,"")
B3:B12B3=IF(E3>0,Home!$B$2,"")
C3:C12C3=IF(E3>0,Home!$B$3,"")
Cells with Data Validation
CellAllowCriteria
U3:U4ListDone,Not Done
R3:R4ListSolved,Pending,Not Attended
S3:S4ListPR,NPR,Exchange,Demo
P3:P4ListYes,No
M3:M4ListIW,OW,Stock Set,EW
 
Upvote 0
Just having a look, this is all possible but just need to know, how many columns of the data do you want copied from the tech sheet to the summary? It looks like you just want the date and if so where do you get all the other data from?
If possible, you could send me a Google Drive or Onedrive link to the file so I can test as I go as this is a little more difficult but if not its ok, I'll do my best
 
Upvote 0
Hi EFANYoutube,

I want to move date from column B to T this is about column, and rows till data is available.
All drives are restricted in my system hence sharing sheets here only.

Sharing all the three sheets to avoid confusion.


Home Tab-( here we are creating worksheets as per the list provided by the user- you have already shared code for this

Daily Monitoring Format.xlsb
ABC
1RegionNorthUser will set
2BranchChandigarhUser will set
3ASC NameKaka ElectronicsUser will set
4GCS CodeG2345562User will set
5Pin to Transfer DataUser will set
6T#Name
7T1User to enter Tech Name name
8T2User to enter Tech Name name
9T3User to enter Tech Name name
10T4User to enter Tech Name name
11T5User to enter Tech Name name
12T6User to enter Tech Name name
13T7User to enter Tech Name name
14T8User to enter Tech Name name
15T9User to enter Tech Name name
16T10User to enter Tech Name name
17T11User to enter Tech Name name
18T12User to enter Tech Name name
19T13User to enter Tech Name name
Home
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B6:B26Cell ValueduplicatestextNO
Cells with Data Validation
CellAllowCriteria
B1ListEast,North,South,West
B2ListAhmedabad,Bangalore,Bhubaneswar,Calcutta,Chandigarh,Chennai,Delhi,Ghaziabad,Guwahati,Hyderabad,Indore,Jaipur,Kochi,Lucknow,Mumbai,Pune



Once Worksheets are created user will fill these sheets as per tech name,
I want the macro to create a data transfer button in each sheet, once clicked either input box should ask for Pin and match entered pin with home tab B5 if match macro to cut data from B to Column T till the data is available in rows and move to ASC summary starting Column E to W and append on each move.

Once moved the technician sheet contents should get cleared so that user can enter new details next time.

If Pin matching is dificult at least one prompt asking are you sure to move data to ASC summary?

Daily Monitoring Format.xlsb
ABCDEFGHIJKLMNOPQRSTU
1SR#DateWork order NoW/o DateCustomer NameAreaModel NoSerial NumberDOPWarranty StatusPart CodePart QtyAppointment StatusAppointment TimeStatus of callType of callAmount CollectedHappy Call StatusHappy Call DateRemarks
2107-01-21RG-1444266288707-01-21Aniruth Abhinandana BhattacharyyaThiruvananthapuramRC4315/789HL099999999999907-01-21Stock Set9965100765811Yes3:30 PMSolved₹ 750.00Not Done07-01-21Customer out of station
3207-01-21RG-1444266288607-01-21ThiruvananthapuramRC4315/789HL099999999999907-01-21EWNot AttendedDone
43
54
65
76
Manoj
Cells with Data Validation
CellAllowCriteria
J2:J7ListIW,OW,Stock Set,EW
M2:M7ListYes,No
O2:O21ListSolved,Pending,Not Attended
P2:P21ListPR,NPR,Exchange,Demo
R2:R7ListDone,Not Done


ASC summary-
Once data copied it will get pasted starting column E to W and append on each move from each sheet.
Region, Branch, CGS code should come from Home tab either with macro or with if the function
And the technician code should get captured from the sheet name from data was moved.

Daily Monitoring Format.xlsb
ABCDEFGHIJKLMNOPQRSTUVWX
1To get filled from Home TabFill based on Sheet name from where data is copied
2RegionBranchGCS CodeTechnician NameDateWork order NoW/o DateCustomer NameAreaModel NoSerial NumberDOPWarranty StatusPart CodePart QtyAppointment StatusAppointment TimeStatus of callType of callAmount CollectedHappy Call StatusHappy Call DateRemarks
3NorthChandigarhKaka ElectronicsManoj07-01-2160-1444266288607-01-21Aniruth Abhinandana BhattacharyyaThiruvananthapuramHL1643/00HL099999999999907-01-21Stock Set9965100765811Yes3:30 PMSolved₹ 750.00Not Done07-01-21Customer out of station
4NorthChandigarhKaka ElectronicsManoj07-01-2160-1444266288607-01-21ThiruvananthapuramHL1643/00HL099999999999907-01-21EWNot AttendedDone
5   
6   
7   
8   
ASC Summary
Cell Formulas
RangeFormula
A3:A8A3=IF(E3>0,Home!$B$1,"")
B3:B8B3=IF(E3>0,Home!$B$2,"")
C3:C8C3=IF(E3>0,Home!$B$3,"")
Cells with Data Validation
CellAllowCriteria
U3:U4ListDone,Not Done
R3:R4ListSolved,Pending,Not Attended
S3:S4ListPR,NPR,Exchange,Demo
P3:P4ListYes,No
M3:M4ListIW,OW,Stock Set,EW


Hope this clarifies.

Thanks & Regards
 
Upvote 0
Ok, looks like a pretty fun little project, Thanks for the explaination, it has made it very clear now.
I'll get back to you soon with the solution
If I create a workbook are you able to open it and get the code?
If not its all good, I will share and explain the code here
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top