PC Review


Reply
Thread Tools Rate Thread

Count Variable

 
 
Paul Black
Guest
Posts: n/a
 
      21st Aug 2007
Hi everyone,

I have a sheet where column one is a number from one to whatever.
In columns two to seven I have a number in each cell.
What I would like to do is, instead of it picking up the number from
column one using the variable GName, use the variable GName as a
counter, so the results will be exactly the same as they are now other
than the GName counter is used instead of it being picked up from the
sheet.

Public Sub Test()
Dim RowData As Range
Dim C As Long
Dim WName As String
Dim WData As String

For Each RowData In ActiveSheet.UsedRange.Rows
With RowData
GName = .Cells(1, 1).Value
GData = ""
For C = 2 To 6
GData = GData & .Cells(1, C).Value & ","
Next C
WData = WData & .Cells(1, 7).Value
Debug.Print "SetGroup" & GName & "," & GData
End With
Next RowData
End Sub

Thanks in dvance.
All the Best.
Paul

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      21st Aug 2007
Is this superseded by your later post?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Paul Black" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi everyone,
>
> I have a sheet where column one is a number from one to whatever.
> In columns two to seven I have a number in each cell.
> What I would like to do is, instead of it picking up the number from
> column one using the variable GName, use the variable GName as a
> counter, so the results will be exactly the same as they are now other
> than the GName counter is used instead of it being picked up from the
> sheet.
>
> Public Sub Test()
> Dim RowData As Range
> Dim C As Long
> Dim WName As String
> Dim WData As String
>
> For Each RowData In ActiveSheet.UsedRange.Rows
> With RowData
> GName = .Cells(1, 1).Value
> GData = ""
> For C = 2 To 6
> GData = GData & .Cells(1, C).Value & ","
> Next C
> WData = WData & .Cells(1, 7).Value
> Debug.Print "SetGroup" & GName & "," & GData
> End With
> Next RowData
> End Sub
>
> Thanks in dvance.
> All the Best.
> Paul
>



 
Reply With Quote
 
Paul Black
Guest
Posts: n/a
 
      21st Aug 2007
Yes Bob,

I thought I had deleted this one.

Thanks in Advance.
All the Best.
Paul

On Aug 21, 11:27 am, "Bob Phillips" <bob....@somewhere.com> wrote:
> Is this superseded by your later post?
>
> --
> ---
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> "Paul Black" <paul_blac...@hotmail.com> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > Hi everyone,

>
> > I have a sheet where column one is a number from one to whatever.
> > In columns two to seven I have a number in each cell.
> > What I would like to do is, instead of it picking up the number from
> > column one using the variable GName, use the variable GName as a
> > counter, so the results will be exactly the same as they are now other
> > than the GName counter is used instead of it being picked up from the
> > sheet.

>
> > Public Sub Test()
> > Dim RowData As Range
> > Dim C As Long
> > Dim WName As String
> > Dim WData As String

>
> > For Each RowData In ActiveSheet.UsedRange.Rows
> > With RowData
> > GName = .Cells(1, 1).Value
> > GData = ""
> > For C = 2 To 6
> > GData = GData & .Cells(1, C).Value & ","
> > Next C
> > WData = WData & .Cells(1, 7).Value
> > Debug.Print "SetGroup" & GName & "," & GData
> > End With
> > Next RowData
> > End Sub

>
> > Thanks in dvance.
> > All the Best.
> > Paul- Hide quoted text -

>
> - Show quoted text -



 
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
Variable Word Count aitch Microsoft Word New Users 4 9th Jul 2008 05:59 PM
Get SQL count into variable Luke Davis Microsoft C# .NET 1 25th Aug 2007 04:55 AM
Using COUNT value as variable =?Utf-8?B?TmF0ZXJhdG9y?= Microsoft Excel Programming 5 14th Jun 2006 03:23 AM
How get count from SQL into VBA variable =?Utf-8?B?bXNjZXJ0aWZpZWQ=?= Microsoft Access Getting Started 1 11th Feb 2005 10:43 PM
variable row count 2 =?Utf-8?B?QmFydA==?= Microsoft Excel Programming 1 15th Dec 2004 10:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:37 PM.