473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

grouping columns in Excel by VBA

Hi all!
I need help with Visual Basic Application 6.0 and Excel.
Problem is that I need group some columns in Excel by Macro in VBA.
Columns are not fixed which mean that every time when a program starts columns
get changed. So that columns I calculate and put them in string.
How can I group those columns in Excel document? I was trying something like
Range (String).group but that doesn't work.
Sep 21 '07 #1
3 7681
kadghar
1,295 Expert 1GB
Hi all!
I need help with Visual Basic Application 6.0 and Excel.
Problem is that I need group some columns in Excel by Macro in VBA.
Columns are not fixed which mean that every time when a program starts columns
get changed. So that columns I calculate and put them in string.
How can I group those columns in Excel document? I was trying something like
Range (String).group but that doesn't work.
I didnt undersand exactly what you need, but his tips might be of help:

range(cells(1,1), cells(5,3)).select

will select the range A1:C5
if you want to have an excel range into an array, the easiest way is to import it into an array of variants

Dim a
a= range(cells(1,1), cells(1,1).end(-4121).end(-4161))

using END will have the same efect as (Ctr + arrow) , you can use excel constants instead of that numbers, but they wont work if you are not using VBA in excel.

HTH
Sep 21 '07 #2
First thank you for your time and answer!
I try what you say but maybe I didn't explain my problem correctly.
I want to make same macro who will group my items in pivot table. Every time when macro is starting he chooses new Pivot Items and then he have to group them. I calculated in what field I have to start and end group but I have filing that grouping is connect only with pivot items not with cells of excel. So obviously I had wrong idea.
Could you help me?
Thank you!
Sep 24 '07 #3
I did it!!
But now I have another problem and he is how to change name of pivot items in column which is grouped.
I tried with
pivotTables().pivotFields().pivotItem.Name= ” ”
or pivotItem.Caption= “ “ ,
if we resume that there is only one pivot item in field.
Thanks
Sep 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Debbie Davis | last post by:
Hi there, SQL 2000 I have the following query: SELECT sponsor, COUNT(sponsor) * 2 AS total FROM Referrals GROUP BY sponsor Works great, returns the sponsor and the total * 2 of their...
0
by: Joe Schmoe | last post by:
I am working on an ASP.NET application that generates an Excel 2003 spreadsheet on demand for the user, containing much sales information, and then editable cells for the salerep user to enter...
0
by: virendra | last post by:
hi, I am working on crystal report 9 in asp.net. I created multilevel dynamic grouping in CR. if page is load firsttime. and i am giving firstlevel of grouping or whatever it's working fine. but...
0
by: FireGeek | last post by:
I need to create a new Access table with columns based on an Excel file. More Information: This task will come before I actually import the Excel file data into my data base. This Excel file...
6
by: sqlbraindead | last post by:
The problem is if I want to group my database on the time basis, how can reconcile the grouping of two different criteria structure? This is an example. Two table I want to use these to get a...
1
by: JC2710 | last post by:
Hi I have a problem which I cant quite solve. I have a query that groups records together to get a Total Price..... Group....... Total Quantity............Price ...
0
by: Radu | last post by:
Hi. I'm trying to read the structure of some Excel 2000 file that the user is expected to upload. The file must be an excel file (solved) and it must contain a column named "PIN". That's all. Now...
0
by: JFKJr | last post by:
I have an excel file, which has columns C and D grouped together, I am trying to delete blank columns and rows from the excel file, ungroup the columns and import the file to MS Access using Access...
3
by: Will | last post by:
Can someone help with code to delete multiple columns from an excel spreadsheet? I know which columns I need to delete. The code below will delete a single column but I'm not sure how to delete...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.