Macro Recording

એક macro ક્રિયાઓનો એક ક્રમ એક વાર record કરે છે અને માંગણી પર એમને ફરી ચલાવે છે, તો એક માસિક report જે તમે પહેલા વીસ clicks માં હાથે બનાવતા હતા એક એકલો button દબાવવો બની જાય છે, અને Excel તમારા માટે code લખે છે.

10 min read · 8 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

એ જ વીસ clicks, દર મહિને

દર મહિને Aryan Meera નો report એ જ રીતે બનાવે છે: import, header format, sales થી sort, totals ઉમેરવા, low-stock rows રંગવી. વીસ થી વધુ clicks, દર વખતે એકસમાન, વીસ મિનિટ નો કંટાળો.

Computers બરાબર આ કરવા મોજૂદ છે: ફરિયાદ વગર એક task દોહરાવવો (BCA103 ની 'diligence' યાદ છે?). તો Aryan આ હાથે કેમ કરી રહ્યો છે?

એક macro એની ક્રિયાઓને એક વાર record કરે છે અને માંગણી પર એમને ફરી ચલાવે છે. આવતા મહિને, એક button દબાવવો બધા વીસ steps કરે છે. અને સૌથી સારી વાત: Excel record કરતા એના માટે code લખે છે. અહીં જ તમે Excel વાપરવું બંધ કરો છો અને એને automate કરવું શરૂ કરો છો.

Theory

એક player piano roll

એક જૂનું player piano એક pianist ના પ્રદર્શન ને એક roll પર record કરે છે, પછી એને બરાબર-બરાબર પાછું વગાડે છે, key દર key, જ્યારે પણ તમે ઇચ્છો, કોઈ pianist જોઈએ નહીં. એક macro Excel માટે એ roll છે: તમારી ક્રિયાઓ એક વાર કરો જ્યારે એ 'record' કરી રહ્યું હોય, અને એ દરેક step પકડે છે. play દબાવો (macro run કરો) અને Excel આખા ક્રમને બિલકુલ સાચું ફરી કરે છે. તમે એને એક વાર શીખવ્યું; એ હંમેશા દોહરાવે છે.

Follow along

તમારો પહેલો macro record અને run કરો

  1. Developer tab > Record Macro; એને નામ આપો અને એક shortcut set કરો Recording હવે શરૂ થાય છે, દરેક ક્રિયા પકડાય છે.
  2. Task એક વાર કરો: format, sort, totals ઉમેરવા એને બરાબર એ રીતે કરો જેમ તમે એને ફરી ચલાવવા માંગો.
  3. Stop Recording ક્લિક કરો Excel એ તમારા steps માટે VBA code આપોઆપ લખી દીધો છે.
  4. આવતા મહિને એને run કરો: shortcut કે Macros button દબાવો બધા steps એકસાથે ફરી ચાલે છે. macro રાખવા .xlsm તરીકે save કરો.

Quiz

Aryan એક શાનદાર macro record કરે છે, પછી workbook ને એક સામાન્ય .xlsx તરીકે save કરીને બંધ કરે છે. આવતા મહિને macro જતો રહ્યો. કેમ?

  1. Macros ને macro-enabled .xlsm format જોઈએ; .xlsx એમને છાનેમાને કાઢી નાખે છે
  2. Macros એક મહિના પછી ખતમ થઈ જાય છે
  3. એણે એને ખોટો record કર્યો
  4. Macros ફક્ત જ્યાં સુધી Excel ખુલ્લું રહે ત્યાં સુધી કામ કરે છે
Show the answer

Macros ને macro-enabled .xlsm format જોઈએ; .xlsx એમને છાનેમાને કાઢી નાખે છે

એક સાદો .xlsx macros store ન કરી શકે, તો એ format માં save કરવું macro કાઢી નાખે છે (ઘણી વાર એક ચેતવણી સાથે જે ચૂકવી સહેલી છે). Macro રાખતા workbooks ને .xlsm (macro-enabled) તરીકે save કરવા જરૂરી છે. આ બરાબર એ ફાંદો છે જે saving lesson માં flag કરેલો: format ને file જે રાખે છે એની સાથે મેળવો. એક .xlsx save થી એક macro ખોવો એક ક્લાસિક અસલી-દુનિયા (અને exam) ભૂલ છે.

Think first

Security ચેતવણીઓ કેમ?

જ્યારે Aryan એક અજ્ઞાત સ્રોત માંથી એક workbook ખોલે છે, Excel ચેતવે છે 'Macros disabled કરાયા છે' અને પૂછે છે કે content enable કરવું કે નહીં. Excel macros વિશે ખાસ કરીને આટલું સાવધ કેમ છે?

Show the answer

કારણ કે એક macro અસલી code છે જે શક્તિશાળી (અને હાનિકારક) વસ્તુઓ કરી શકે, files delete કરવી, data બદલવો, બીજા workbooks માં ફેલાવું. એક untrusted સ્રોત માંથી file માં એક દ્વેષપૂર્ણ macro તમારા system ને નુકસાન પહોંચાડી શકે, તો Excel default રીતે macros disable કરે છે અને એમને ચલાવ્યા પહેલા પૂછે છે. Content ફક્ત એ સ્રોતોમાંથી enable કરો જેમના પર તમે ભરોસો કરો છો. એ જ કારણ છે કે macro-enabled files ને એક security વિચાર માનવામાં આવે છે, કોઈ પણ downloaded program જેવો એ જ code-હાનિકારક-હોઈ-શકે logic (BCA103).

Watch out

Marks ક્યાં કપાય છે

એ ભૂલવું કે macros ને save માં બચવા .xlsm (macro-enabled) જોઈએ. એ ન જાણવું કે macros Developer tab / Record Macro ના દ્વારા record થાય છે અને પકડેલી ક્રિયાઓ ફરી ચલાવે છે. security પાસું ચૂકવું (untrusted macros દ્વેષપૂર્ણ હોઈ શકે, એટલે enable-content ચેતવણી). અને એ ન સમજવું કે Excel record કરતા પડદા પાછળ VBA code લખે છે, જે બરાબર એ છે જે આગળનો lesson ખોલે છે. Automation + security + .xlsm exam મુદ્દા છે.

Theory

Record કરેલો code તમારો શિક્ષક છે

અહીં ચતુર ભાગ છે: એક macro record કરો, પછી Excel એ જે code લખ્યો એને જુઓ, એ VBA છે, એક અસલી programming ભાષા, અને એને વાંચવું VBA શીખવાની સૌથી સહેલી રીત છે. recorder તમારો અંગત tutor છે. આગળનો lesson VBA editor ખોલે છે અને તમને તમારા macro ની પાછળનો code બતાવે છે, તમારા BCA104 programming કૌશલ્ય ને Excel automation સાથે જોડતા. આગળ: VBA editor નો પરિચય અને પાયાનું VBA.

Summary

Key takeaways

  • એક macro ક્રિયાઓનો એક ક્રમ એક વાર record કરે છે અને માંગણી પર એમને ફરી ચલાવે છે, દોહરાવ વાળા tasks automate કરતા.
  • Developer tab (Record Macro) ના દ્વારા record કરો, steps કરો, Stop; shortcut કે button થી run કરો.
  • Excel record કરતા તમારી ક્રિયાઓ પકડતો VBA code લખે છે.
  • .xlsm (macro-enabled) તરીકે save કરો નહીંતર save પર macro કઢાઈ જાય છે.
  • Macros code છે અને હાનિકારક હોઈ શકે, તો Excel untrusted macros disable કરે છે (content ફક્ત ભરોસાપાત્ર સ્રોતોમાંથી enable કરો).
  • યાદ રાખવાની યુક્તિ: એક player piano roll, એક વાર record, બિલકુલ સાચું ફરી વગાડો.

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Automation & Advanced Tools

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Macro Recording · Mastering Worksheet (SEC-01 option A) · Gri-Learn