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

एक्सेल में हेडर वैल्यू के आधार पर संपूर्ण कॉलम कैसे हटाएं?

लेखक: सिलुविया अंतिम संशोधित: 2021-12-31

कई मामलों में, आपको एक्सेल में हेडर वैल्यू के आधार पर पूरे कॉलम को हटाने की आवश्यकता हो सकती है। उदाहरण के लिए, आपको उन सभी कॉलमों को हटाना होगा जिनमें हेडर में "पुराना" मान है। इस ट्यूटोरियल में, हम आपको हेडर वैल्यू के आधार पर पूरे कॉलम को हटाने के तरीके विस्तार से दिखाएंगे।

VBA कोड के साथ हेडर मान के आधार पर संपूर्ण कॉलम हटाएं
एक्सेल के लिए कुटूल के साथ हेडर वैल्यू के आधार पर संपूर्ण कॉलम हटाएं


VBA कोड के साथ हेडर मान के आधार पर संपूर्ण कॉलम हटाएं

आप VBA कोड के साथ हेडर मान के आधार पर संपूर्ण कॉलम हटा सकते हैं। कृपया निम्नानुसार करें.

1। दबाएँ ऑल्ट + F11 खोलने के लिए एक साथ कुंजियाँ माइक्रोसॉफ्ट विज़ुअल बेसिक एप्लिकेशन खिड़की.

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

वीबीए कोड: हेडर मान के आधार पर संपूर्ण कॉलम हटाएं

Sub DeleteSpecifcColumn()
	Set MR = Range("A1:D1")
	For Each cell In MR
		If cell.Value = "old" Then cell.EntireColumn.Delete
	Next
End Sub

नोट्स:

1) कोड में, “पुराना” वह हेडर मान है जिसके आधार पर आप संपूर्ण कॉलम को हटाना चाहते हैं। कृपया अपने हेडर मान को मैन्युअल रूप से बदलें। और ए1:डी1 वह स्तंभ श्रेणी है जिसका आप उपयोग करना चाहते हैं।
2) यह कोड केस-संवेदी है।

3। दबाएं F5 कोड को चलाने के लिए कुंजी, निर्दिष्ट पाठ के बराबर हेडर वाला पूरा कॉलम तुरंत हटा दिया जाएगा।


एक्सेल के लिए कुटूल के साथ हेडर वैल्यू के आधार पर संपूर्ण कॉलम हटाएं

- एक्सेल के लिए कुटूलहै विशिष्ट कक्षों का चयन करें उपयोगिता, आप आसानी से उन सभी कॉलमों का चयन कर सकते हैं जिनमें पहले निश्चित हेडर मान शामिल है, और फिर इन चयनित कॉलमों को एक ही बार में हटा सकते हैं। कृपया निम्नानुसार करें.

आवेदन करने से पहले एक्सेल के लिए कुटूल, कृपया सबसे पहले इसे डाउनलोड करें और इंस्टॉल करें.

1. उस श्रेणी का चयन करें जिसमें वे कॉलम हैं जिन्हें आपको हटाना है, और फिर क्लिक करें कुटूल > चुनते हैं > विशिष्ट कक्षों का चयन करें. स्क्रीनशॉट देखें:

2। में विशिष्ट कक्षों का चयन करें संवाद बॉक्स, का चयन करें पूर्ण स्तंभ में विकल्प चयन प्रकार अनुभाग, और में विशिष्ट प्रकार ड्रॉप-डाउन सूची, का चयन करें बराबरी विकल्प, फिर निम्न बॉक्स में हेडर मान टाइप करें। और अंत में क्लिक करें OK बटन। स्क्रीनशॉट देखें:

3. क्लिक करें OK दूसरे पॉप अप डायलॉग बॉक्स में बटन, फिर निर्दिष्ट हेडर मान वाले कॉलम तुरंत चुने जाते हैं।

4. चयनित कॉलम के कॉलम हेडर पर राइट क्लिक करें और फिर क्लिक करें मिटाना राइट-क्लिक मेनू से। फिर सभी चयनित कॉलम एक साथ हटा दिए जाते हैं।

  यदि आप इस उपयोगिता का निःशुल्क परीक्षण (30-दिन) चाहते हैं, कृपया इसे डाउनलोड करने के लिए क्लिक करें, और फिर उपरोक्त चरणों के अनुसार ऑपरेशन लागू करने के लिए जाएं।

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

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

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

Description


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

  • Word, Excel, PowerPoint में टैब्ड संपादन और रीडिंग सक्षम करें, प्रकाशक, एक्सेस, विसियो और प्रोजेक्ट।
  • नई विंडो के बजाय एक ही विंडो के नए टैब में एकाधिक दस्तावेज़ खोलें और बनाएं।
  • आपकी उत्पादकता 50% बढ़ जाती है, और आपके लिए हर दिन सैकड़ों माउस क्लिक कम हो जाते हैं!
Comments (13)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi, I need to delete a load of columns containing # in the headings - my understanding of VBA is very limited and the report has about 60 columns. The # is not always in the same location in each heading, so I need to identify any columns with the # in the heading and remove those columns. Is anyone able to guide me on this please?

I also need to split the report into 3 sections - the data runs across the worksheet (ie column A - H is Sales invoices; column I-Z is Purchase invoices and column AA-AG is Payments - each of these need to go onto a seperate worksheet - it is very labour intensive doing this manually so I am hoping someone can help me in VBA with this one as well.

Thanks
This comment was minimized by the moderator on the site
Hola, tengo una hoja de excel con varios datos, digamos 4 columnas y 12 filas, me gustaría poder imprimir cada fila en un folio separado en una plantilla, es decir, tenemos una hoja con varios nombres y apellidos y teléfono, quiero imprimir tantas páginas como filas tenga la hoja de excel, he inte tado varias cosas pero no encuentro la forma. Gracias de antemano
This comment was minimized by the moderator on the site
Hi,
If you want to print each row in a separate page in the worksheet, here is a suggestion that you insert page breaks every 1 row and then print them.
Methods provided in this article may do you a favor. Please have a try. Thank you.
How To Insert Page Break Every X Rows In Excel?[/url]
https://www.extendoffice.com/documents/excel/1774-excel-insert-page-break-every-row.html
This comment was minimized by the moderator on the site
The VBA example states that the code will delete all columns whose headers CONTAIN "old." That is not the case. The = operator will only delete exact matches. You need to use the LIKE operator with a wildcard.
Fixed code:Sub DeleteSpecifcColumn()
Set MR = Range("A1:D1")
For Each cell In MR
If cell.Value LIKE "old*" Then cell.EntireColumn.Delete
Next
End Sub

This comment was minimized by the moderator on the site
Hi,Thank you for your correction and sharing. 
This comment was minimized by the moderator on the site
Hi, is it possible to do this with multiple column names?
This comment was minimized by the moderator on the site
What if the headers are starting from 4th row
This comment was minimized by the moderator on the site
Hi Mark,
Try the below code. In the eighth line, please enclose each column name with double quotes and separate them by comma. Hope I can help. Thank you.

Sub DeleteSpecifcColumn()

Dim xFNum, xFFNum, xCount As Integer

Dim xStr As String

Dim xArrName As Variant

Dim MR, xRg As Range

On Error Resume Next

Set MR = Range("A1:N1")

xArrName = Array("old", "new", "get") 'enclose each column name with double quotes and separate them by comma

xCount = MR.Count

xStr = xArrName(xFNum)

For xFFNum = xCount To 1 Step -1

Set xRg = Cells(1, xFFNum)

For xFNum = 0 To UBound(xArrName)

xStr = xArrName(xFNum)

If xRg.Value = xStr Then xRg.EntireColumn.Delete

Next xFNum

Next

End Sub
This comment was minimized by the moderator on the site
I think line 12 needs to be changed to get the code to work. Original line 12 "Set xRg = Cells(1, xFFNum)" modified line 12 "Set xRg = MR(1, xFFNum)"
Sub DeleteSpecifcColumn()
Dim xFNum, xFFNum, xCount As Integer
Dim xStr As String
Dim xArrName As Variant
Dim MR, xRg As Range
On Error Resume Next
Set MR = Range("A1:N1")
xArrName = Array("old", "new", "get") 'enclose each column name with double quotes and separate them by comma
xCount = MR.Count
xStr = xArrName(xFNum)
For xFFNum = xCount To 1 Step -1
Set xRg = MR(1, xFFNum)
For xFNum = 0 To UBound(xArrName)
xStr = xArrName(xFNum)
If xRg.Value = xStr Then xRg.EntireColumn.Delete
Next xFNum
Next
End Sub
This comment was minimized by the moderator on the site
Hey! This works well until you have two contiguous columns with the same header. Say your range is A1:A5, and A2 and A3 have the header 'old'. It will delete A2, but then the A3 will move to the place A2 used to occupy, and the code will skip it, as it will be looking at the new A3, the next cell on its range.
This comment was minimized by the moderator on the site
Hi Elias,
As you mentioned, A2 and A3 have he same header "old". But they are in the same column, after applying the code, the whole column A will be removed immediately.
I am not sure I get your point. Would be nice if you could provide screenshot of what you are trying to do.
This comment was minimized by the moderator on the site
Sorry if this seems super basic but this is my first time trying vba. Using this how would I apply it to delete multiple column headers. I am actually trying to only keep certain header columns and delete the rest of a changing list.
This comment was minimized by the moderator on the site
In the first code just copy the 4th row and change the "old" into the second column name and it will work
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations