Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default column heading

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default column heading

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default column heading

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" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default column heading

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" wrote in message
...
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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want column heading non-scrolling and rows of each column scrol Q Abdul New Users to Excel 1 July 22nd 08 03:44 PM
How do I put a heading even with a column? Stressing out New Users to Excel 5 December 15th 07 05:28 PM
In a table produce an value by column heading and row heading naflan Excel Worksheet Functions 1 December 27th 05 05:18 PM
Find Column heading and then Delete entire column Kobayashi[_58_] Excel Programming 4 October 17th 05 09:09 PM
Need Macro to Find Column Heading -- if none, then insert new column Jeff[_43_] Excel Programming 0 December 15th 04 07:08 AM


All times are GMT +1. The time now is 11:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"