मुख्य सामग्री पर जाएं

अन्य शीट सेल का संदर्भ देते समय सेल फ़ॉर्मेटिंग कैसे रखें?

लेखक: रवि अंतिम संशोधित: 2020-09-03

आम तौर पर, सेल अन्य सेल को संदर्भित करते समय केवल सेल मान रखता है, लेकिन इस आलेख में, मैं किसी अन्य सेल को संदर्भित करते समय सेल मान और फ़ॉर्मेटिंग को बनाए रखने के लिए एक वीबीए कोड पेश करता हूं, और सेल मान और फ़ॉर्मेटिंग नीचे दिए गए अनुसार संदर्भ सेल में परिवर्तन के रूप में बदलता है। स्क्रीनशॉट दिखाया गया.
दस्तावेज़ 1 का संदर्भ देते समय फ़ॉर्मेटिंग जारी रखें

VBA के साथ किसी अन्य सेल को संदर्भित करते समय सेल फ़ॉर्मेटिंग रखें


VBA के साथ किसी अन्य सेल को संदर्भित करते समय सेल फ़ॉर्मेटिंग रखें

इस कार्य को संभालने के लिए, आपको बस नीचे दिए गए कोड को चलाने की आवश्यकता है।

1. आपके द्वारा उपयोग की जाने वाली कार्यपुस्तिका को सक्षम करें, दबाएँ ऑल्ट + F11 सक्षम करने की कुंजी अनुप्रयोग के लिए माइक्रोसॉफ्ट विज़ुअल बेसिक विंडो, और शीट नाम पर डबल क्लिक करें जिसमें आप संदर्भ सेल रखेंगे परियोजना-वीबीएपरियोजना रिक्त स्क्रिप्ट दिखाने के लिए फलक। इस मामले में, मैं सेल का उल्लेख करना चाहता हूं A1 में Sheet1. स्क्रीनशॉट देखें:
दस्तावेज़ 2 का संदर्भ देते समय फ़ॉर्मेटिंग जारी रखें

2. नीचे दिए गए कोड को स्क्रिप्ट में चिपकाएँ, और VBA कोड में, अपनी आवश्यकतानुसार सेल संदर्भ निर्दिष्ट करें।

वीबीए: किसी अन्य सेल को संदर्भित करते समय फ़ॉर्मेटिंग और मान रखें

Private Sub Worksheet_Activate()
'UpdatebyExtendoffice20101024
    Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Or Target.Value = "" Then Exit Sub
    Application.EnableEvents = False
    If Not Intersect(Target, Range("A1")) Is Nothing Then              'Range("A1") the reference cell
        Target.Copy
        ActiveWorkbook.Sheets("Sheet2").Range("B1").PasteSpecial xlPasteAllUsingSourceTheme
                    'Range("B1")the cell linked to reference cell,ActiveWorkbook.Sheets("Sheet2")the sheet which contains linked cell
        Application.CutCopyMode = False
        Target.Select
    End If
    Application.EnableEvents = True
End Sub

नोट: A1 संदर्भ कक्ष है, B1 in शीट 2 वह सेल है जिसे आप संदर्भ सेल से लिंक करना चाहते हैं और Shee1 में A1 के साथ मान और फ़ॉर्मेटिंग रखना चाहते हैं।

फिर जब आप शीट1 में सेल A1 में मान या फ़ॉर्मेटिंग बदलते हैं, तो संदर्भ सेल पर दो बार क्लिक करने पर शीट1 में सेल B2 बदल जाएगा।


रंग के अनुसार गिनती करें

कुछ मामलों में, आपके पास कई रंगों के साथ कैल्यूज़ की एक श्रृंखला हो सकती है, और आप जो चाहते हैं वह एक ही रंग के आधार पर मानों की गणना/योग करना है, आप जल्दी से गणना कैसे कर सकते हैं?
- एक्सेल के लिए कुटूल's रंग के अनुसार गिनती करें, आप रंग के आधार पर कई गणनाएँ शीघ्रता से कर सकते हैं, और परिकलित परिणाम की एक रिपोर्ट भी तैयार कर सकते हैं।
रंग के अनुसार दस्तावेज़ गिनती

सर्वोत्तम कार्यालय उत्पादकता उपकरण

🤖 कुटूल्स एआई सहयोगी: निम्न के आधार पर डेटा विश्लेषण में क्रांति लाएं: बुद्धिमान निष्पादन   |  कोड जनरेट करें  |  कस्टम फ़ॉर्मूले बनाएं  |  डेटा का विश्लेषण करें और चार्ट बनाएं  |  कुटूल फ़ंक्शंस का आह्वान करें...
लोकप्रिय सुविधाएँ: डुप्लिकेट ढूंढें, हाइलाइट करें या पहचानें   |  रिक्त पंक्तियाँ हटाएँ   |  डेटा खोए बिना कॉलम या सेल को संयोजित करें   |   फॉर्मूला के बिना गोल ...
सुपर लुकअप: एकाधिक मानदंड VLookup    मल्टीपल वैल्यू वीलुकअप  |   अनेक शीटों में VLookup   |   फजी लुकअप ....
उन्नत ड्रॉप-डाउन सूची: शीघ्रता से ड्रॉप डाउन सूची बनाएं   |  आश्रित ड्रॉप डाउन सूची   |  बहु-चयन ड्रॉप डाउन सूची ....
स्तम्भ प्रबंधक: कॉलमों की एक विशिष्ट संख्या जोड़ें  |  कॉलम ले जाएँ  |  छिपे हुए कॉलम की दृश्यता स्थिति टॉगल करें  |  रेंज और कॉलम की तुलना करें ...
फीचर्ड फीचर्स: ग्रिड फोकस   |  डिजाइन देखें   |   बड़ा फॉर्मूला बार    कार्यपुस्तिका एवं शीट प्रबंधक   |  संसाधन लाइब्रेरी (ऑटो टेक्स्ट)   |  खजूर बीनने वाला   |  कार्यपत्रकों को संयोजित करें   |  एन्क्रिप्ट/डिक्रिप्ट सेल    सूची के अनुसार ईमेल भेजें   |  सुपर फ़िल्टर   |   विशेष फ़िल्टर (फ़िल्टर बोल्ड/इटैलिक/स्ट्राइकथ्रू...) ...
शीर्ष 15 टूलसेट12 टेक्स्ट टूल्स (पाठ जोड़ें, अक्षर हटाएँ, ...)   |   50 + चार्ट प्रकार (गैन्ट चार्ट, ...)   |   40+ प्रैक्टिकल सूत्र (जन्मदिन के आधार पर आयु की गणना करें, ...)   |   19 निवेशन टूल्स (QR कोड डालें, पथ से चित्र सम्मिलित करें, ...)   |   12 रूपांतरण टूल्स (शब्दों को संख्याएँ, मुद्रा रूपांतरण, ...)   |   7 विलय और विभाजन टूल्स (उन्नत संयोजन पंक्तियाँ, विभाजन कोशिकाओं, ...)   |   ... और अधिक

एक्सेल के लिए कुटूल के साथ अपने एक्सेल कौशल को सुपरचार्ज करें, और पहले जैसी दक्षता का अनुभव करें। एक्सेल के लिए कुटूल उत्पादकता बढ़ाने और समय बचाने के लिए 300 से अधिक उन्नत सुविधाएँ प्रदान करता है।  वह सुविधा प्राप्त करने के लिए यहां क्लिक करें जिसकी आपको सबसे अधिक आवश्यकता है...

Description


ऑफिस टैब ऑफिस में टैब्ड इंटरफ़ेस लाता है, और आपके काम को बहुत आसान बनाता है

  • Word, Excel, PowerPoint में टैब्ड संपादन और रीडिंग सक्षम करें, प्रकाशक, एक्सेस, विसियो और प्रोजेक्ट।
  • नई विंडो के बजाय एक ही विंडो के नए टैब में एकाधिक दस्तावेज़ खोलें और बनाएं।
  • आपकी उत्पादकता 50% बढ़ जाती है, और आपके लिए हर दिन सैकड़ों माउस क्लिक कम हो जाते हैं!
Comments (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello, I would like to keep the format of my reference cell. However, even with your VBA it doesn't work. Can you help me please?
I would like my B2 cell of my sheet 1 to be my reference cell for my C2 cells of sheets 2,3,4,5,6,7.
My document is a list of people, therefore I will have several cells of references not the continuation.
Thanks in advance
This comment was minimized by the moderator on the site
No tienes uno que sea dentro del mismo archivo
This comment was minimized by the moderator on the site
Thanks for sharing this. I have a range of cells in WorksheetA, Sheet1, Range G3:G3000 that I want to reference in WorksheetB, Sheet1, Range G3:G3000. I need WorksheetB, Sheet1, Range G3:G3000 to display both the value and the format of the referenced cells in WorksheetA, Sheet1, G3:G3000. Is there a VBA script that will allow for this?
This comment was minimized by the moderator on the site
Thanks for sharing this. Is there a VBA script that allows for referencing a range of cells in one workbook and then displaying the value and format of the referenced cells in a different workbook?
This comment was minimized by the moderator on the site
Thank you so much for the script. Can you tell me if there is a way for the linked cell to update without having to double click on the reference cell? Thank you!
This comment was minimized by the moderator on the site
hello, I believe this may be just what I am looking for. I need the referenced text to have the same colors and features from the referenced page. The only thing different about mine is that I am pulling from a larger range. I have never used VBA before so I wanted to confirm before I did changes. I am pulling from a document (sheet 2) onto (sheet 1) document. I have used IF formulas to do this, so it returns a value from 3 different columns and they are not in a row. The columns are F,H,J. Could you please help me figure out how I can make this work?
This comment was minimized by the moderator on the site
I am dealing with similar issue. I have a formula in column C, which takes value from the same row, column A. (But only IF B3 is not x AND A3 is not empty):

=IF(B3="x";"y";IF(A3="";"z";A3))

Cells of column A look like this: OK 2019_12_03
But "OK" is in bold format. I would like to keep this format.
I want this for hundreds of cells, so clicking or writing a script for each one of them is undesirable. Any ideas if such feature exists? I'd appreciate some kind of "WITHFORMAT()" function that I could put in the formula, so the following formula would keep the original format:

=IF(B3="x";"y";IF(A3="";"z";WITHFORMAT(A3)))
This comment was minimized by the moderator on the site
Sorry, your problem is a bit complex, I do not understand clearly.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations