PC Review


Reply
Thread Tools Rate Thread

column heading

 
 
=?Utf-8?B?SGVtYW50X2luZGlh?=
Guest
Posts: n/a
 
      7th Aug 2007
hi
i have a sheet having 52 columns and around 2000 rows
actually the data is imported from access table
therefore first row is occupied by the fields name
my question is how do i use these field names while coding in vba?
--
hemu
 
Reply With Quote
 
 
 
 
Bernard Liengme
Guest
Posts: n/a
 
      7th Aug 2007
I had this data stating in A1
name account owing
smith a12 10
jones a22 20
liengme a33 30
macdonald a45 25



Here is a very simple subrountine to play with
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 07/08/2007 by Bernard V Liengme
'

'
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:= _
False
Range("A1").Select
MsgBox Application.Sum(Range("owing"))
End Sub


--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Hemant_india" <(E-Mail Removed)> wrote in message
news:C65250E4-562F-4BCA-BB01-(E-Mail Removed)...
> hi
> i have a sheet having 52 columns and around 2000 rows
> actually the data is imported from access table
> therefore first row is occupied by the fields name
> my question is how do i use these field names while coding in vba?
> --
> hemu



 
Reply With Quote
 
=?Utf-8?B?SGVtYW50X2luZGlh?=
Guest
Posts: n/a
 
      7th Aug 2007
hi bernard
suppose the data is like this
amt1 amt2
5000 10000
and i have to write code as msgbox(row(n).amt1+row(n).am2)
--
hemu


"Bernard Liengme" wrote:

> I had this data stating in A1
> name account owing
> smith a12 10
> jones a22 20
> liengme a33 30
> macdonald a45 25
>
>
>
> Here is a very simple subrountine to play with
> Sub Macro2()
> '
> ' Macro2 Macro
> ' Macro recorded 07/08/2007 by Bernard V Liengme
> '
>
> '
> Range("A1").Select
> Range(Selection, Selection.End(xlToRight)).Select
> Range(Selection, Selection.End(xlDown)).Select
> Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:= _
> False
> Range("A1").Select
> MsgBox Application.Sum(Range("owing"))
> End Sub
>
>
> --
> Bernard V Liengme
> Microsoft Excel MVP
> www.stfx.ca/people/bliengme
> remove caps from email
>
> "Hemant_india" <(E-Mail Removed)> wrote in message
> news:C65250E4-562F-4BCA-BB01-(E-Mail Removed)...
> > hi
> > i have a sheet having 52 columns and around 2000 rows
> > actually the data is imported from access table
> > therefore first row is occupied by the fields name
> > my question is how do i use these field names while coding in vba?
> > --
> > hemu

>
>
>

 
Reply With Quote
 
Bernard Liengme
Guest
Posts: n/a
 
      7th Aug 2007
Try this
'
' Macro1 Macro
' Macro recorded 07/08/2007 by Bernard V Liengme
'

'
Range("A1:C4").Select
Application.CutCopyMode = False
Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:= _
False
Set amt1 = Range("amt1")
Set amt2 = Range("amt2")

MsgBox amt1(2) + amt2(2)


End Sub

--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Hemant_india" <(E-Mail Removed)> wrote in message
news:25E109BA-5EEC-425F-96A0-(E-Mail Removed)...
> hi bernard
> suppose the data is like this
> amt1 amt2
> 5000 10000
> and i have to write code as msgbox(row(n).amt1+row(n).am2)
> --
> hemu
>
>
> "Bernard Liengme" wrote:
>
>> I had this data stating in A1
>> name account owing
>> smith a12 10
>> jones a22 20
>> liengme a33 30
>> macdonald a45 25
>>
>>
>>
>> Here is a very simple subrountine to play with
>> Sub Macro2()
>> '
>> ' Macro2 Macro
>> ' Macro recorded 07/08/2007 by Bernard V Liengme
>> '
>>
>> '
>> Range("A1").Select
>> Range(Selection, Selection.End(xlToRight)).Select
>> Range(Selection, Selection.End(xlDown)).Select
>> Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:=
>> _
>> False
>> Range("A1").Select
>> MsgBox Application.Sum(Range("owing"))
>> End Sub
>>
>>
>> --
>> Bernard V Liengme
>> Microsoft Excel MVP
>> www.stfx.ca/people/bliengme
>> remove caps from email
>>
>> "Hemant_india" <(E-Mail Removed)> wrote in message
>> news:C65250E4-562F-4BCA-BB01-(E-Mail Removed)...
>> > hi
>> > i have a sheet having 52 columns and around 2000 rows
>> > actually the data is imported from access table
>> > therefore first row is occupied by the fields name
>> > my question is how do i use these field names while coding in vba?
>> > --
>> > hemu

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
In a table produce an value by column heading and row heading =?Utf-8?B?bmFmbGFu?= Microsoft Excel Worksheet Functions 1 27th Dec 2005 05:18 PM
Need Macro to Find Column Heading -- if none, then insert new column Jeff Microsoft Excel Programming 0 15th Dec 2004 07:08 AM
Go to column heading on start where column heading matches Today() =?Utf-8?B?SmFtZXMgRA==?= Microsoft Excel Worksheet Functions 1 3rd Jul 2004 03:13 PM
Excel 2000 - Missing row heading, but have column heading Peter Microsoft Excel Misc 1 24th Jun 2004 02:02 AM
Changing column/row heading color when a cell in that column/row is selected Christi Microsoft Excel Worksheet Functions 2 13th Jul 2003 12:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:40 AM.