विषयसूची

From Active Cell to Last Entry

This example illustrates the End property of the Range object in एक्सेल VBA. We will use this property to select the range from the Active Cell to the last entry in a column.

परिस्थिति:

Some sales figures in column A. Assume that you will be adding more sales figures over time.

एक्सेल VBA में सक्रिय सेल से अंतिम प्रविष्टि तक

अपनी वर्कशीट पर एक कमांड बटन रखें और निम्नलिखित कोड पंक्तियाँ जोड़ें:

1. To select the last entry in a column simply add the following code line:

Range(“A5”).End(xlDown).Select

Note: instead of Range(“A5”) you can also use Range(“A1”) Range(“A2”) etc. This code line is equivalent to pressing the END+DOWN ARROW.

जब आप शीट पर कमांड बटन क्लिक करेंगे तो परिणाम:

Last Entry

2. To select the range from cell A5 to the last entry in the column add the following code line:

Range(Range(“A5”) Range(“A5”).End(xlDown)).Select

जब आप शीट पर कमांड बटन क्लिक करेंगे तो परिणाम:

From Cell A5 to Last Entry

3. To select the range from the Active Cell to the last entry in the column simply replace Range(“A5”) with ActiveCell.

Range(ActiveCell ActiveCell.End(xlDown)).Select

Result when you select cell A2 and click the command button on the sheet:

From Active Cell to Last Entry Result

Note: you can use the constants xlUp xlToRight and xlToLeft to move in the other directions. This way you can select a range from the Active Cell to the last entry in a row.

एक टिप्पणी छोड़ें

एक्सेल एआई से मिलता है - अपनी उत्पादकता को पहले जैसा बढ़ाएं!

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

संबंधित आलेख