Go Back   TechArena Community > Software > Windows Software
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to find particular column name by using Excel Macro

Windows Software


Reply
 
Thread Tools Search this Thread
  #1  
Old 03-04-2011
Member
 
Join Date: Mar 2011
Posts: 71
How to find particular column name by using Excel Macro
  

Hello yesterday I faced one problem with my Excel. I have Excel shit which contains column names in row#1. Basically I am facing problem with excel macro. I want to write excel macro that will appear for column names no matter which that had 'ID' or 'AMT' in it, and be supposed to format complete column apart from 1st row which has name in 0000-000-00 for ID and $ 000,000,00.00 for AMT. So that time devoted in formatting every column will be concentrated. I would really appreciate if somebody be acquainted with solution about it. Thanks in advance.

Reply With Quote
  #2  
Old 03-04-2011
Member
 
Join Date: Jun 2009
Posts: 1,518
Re: How to find particular column name by using Excel Macro

Hello please follow this macro I hope this will help you to solve your problem. Because some day before I was facing similar kind of problem them I follow this macro and by using this I solve my problem.
Sub tesmacr()
Dim i As Integer, cfindmacro As Range
Set cfindmacro = ActiveSheet.UsedRange.Cells.Find(what:="ID", lookat:=xlWhole)
i = cfind.Column
Columns(i).NumberFormat = "000-000-000"
Set cfindmacro = ActiveSheet.UsedRange.Cells.Find(what:="AMT", lookat:=xlWhole)
i = cfindmacro.Column
Columns(i).NumberFormat = "000,000,00#.00"
End Sub
I hope it will work for you.
Reply With Quote
  #3  
Old 03-04-2011
Member
 
Join Date: Mar 2011
Posts: 71
Re: How to find particular column name by using Excel Macro

Hi, thank you for your quick response on my query. I try this code and its working fine with excel. But in my case basically column is not always ID; it can be ID1, 1_ID, ID_1. So I require searching columns with key like ID and then format. And in another case, in addition ID column will forever have alphanumeric values similar to 123CD6789 and I wish for it as 123-CD6-789.NumberFormat doesn't perform on behalf of alphanumeric.
Reply With Quote
  #4  
Old 03-04-2011
Member
 
Join Date: Mar 2011
Posts: 77
Re: How to find particular column name by using Excel Macro

Hello guys I am facing similar kind of problem related to this macro. I am using Microsoft office 2007 in my system. And I am doing all my office work on this Excel. So this Excel is more important in my work. I donít understand how to fix this ID related issues. I try to find about this on internet but not get much information on this topic. How I can write macro with any ID. Because, ID is not a big factor still itís not performing. Some day before, I read seaware about the wild card in macro. Is it possible to use them with this? Can anyone tell me how you can use wildcard for searching? Help me thank you.
Reply With Quote
  #5  
Old 03-04-2011
Member
 
Join Date: Nov 2008
Posts: 1,514
Re: How to find particular column name by using Excel Macro

Hello follow the following code by using this you can set wildcard with macro for your code. You have to use
what: = like this
what: ="*id*

and observe whether you achieve something. Basically when you are using star sign before and after is known as wildcard in the company of the ID in between. By using wild card some items achieve something and some time itís not performing as your requirement. So I hope this will work for your thank you.
Reply With Quote
  #6  
Old 05-04-2011
Member
 
Join Date: Mar 2009
Posts: 1,360
Re: How to find particular column name by using Excel Macro

When responsibility searches in Excel, you can make use of wildcard characters in the pattern of what you are trying to search with Excel. On the other hand, you cannot make use of them in the alternate text. These tips look at ways you are able to work around this limitation and utilize wildcards in your replacements. This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007. I hope now you are clear with your doubt about this wildcard processing with macro in Excel.
Reply With Quote
Reply

  TechArena Community > Software > Windows Software
Tags: , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to find particular column name by using Excel Macro"
Thread Thread Starter Forum Replies Last Post
Excel macro: Cells.Find finding value from a variable? pkpn Software Development 2 14-05-2011 03:31 PM
Find The Value of one column in another column Charth Windows Software 3 23-02-2011 02:01 AM
Excel Macro querying a table by column name Halyn Software Development 3 14-10-2009 08:59 PM
Cannot find macro working in excel 2007 Visala Windows Software 3 06-08-2009 11:47 PM
How to find value in Excel column and then fill down to a particular row Aienstaien Software Development 3 01-07-2009 03:04 PM


All times are GMT +5.5. The time now is 08:44 PM.