Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Help with Columns

Good afternoon,

This code worked fine until I inserted an extra column at the very
front of my data (column "A" is blank, added column "B", data now
starts in column "C" instead of column "B")
How can I change it so it still works although EVERYTHING has moved
one column to the right.
Thanks in advance.

Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Help with Columns

On Oct 15, 1:20*pm, Paul Black wrote:
Good afternoon,

This code worked fine until I inserted an extra column at the very
front of my data (column "A" is blank, added column "B", data now
starts in column "C" instead of column "B")
How can I change it so it still works although EVERYTHING has moved
one column to the right.
Thanks in advance.

Paul


Sorry, would help if I put the code ...

Option Explicit
Option Base 1

Sub Multiple_Combination_Checker_PAB()
Dim Start As Double
Start = Timer
Dim Bonus As Long
Dim CombinationDrawn As Range
Dim CombinationToCheck As Range
Dim Matched() As Long
Dim NonBonus As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Sheets("Macro Program").Select

For Each CombinationToCheck In Range(Cells(8, 10), Cells(Rows.Count,
10).End(xlUp))
Erase Matched
ReDim Matched(0 To 7)
For Each CombinationDrawn In Range(Cells(8, 2), Cells(Rows.Count,
2).End(xlUp))
NonBonus = Evaluate("Sum(Countif(" & CombinationToCheck.Resize
(1, 6).Address & _
"," & CombinationDrawn.Resize(1, 6).Address & "))")
Bonus = Evaluate("Countif(" & CombinationToCheck.Resize(1,
6).Address & _
"," & CombinationDrawn.Offset(0, 6).Address & ")")
If NonBonus = 6 Then
Matched(7) = Matched(7) + 1
ElseIf NonBonus = 5 And Bonus = 1 Then
Matched(6) = Matched(6) + 1
Else
Matched(NonBonus) = Matched(NonBonus) + 1
End If
Next
CombinationToCheck.Offset(0, 7).Resize(1, 8).Value = Matched
Next

Range("A1").Value = Format(((Timer - Start) / 24 / 60 / 60),
"hh:mm:ss")

Range("B1519").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

.... Thanks, Paul
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Help with Columns

Sub Multiple_Combination_Checker_PAB()
Dim Start As Double
Start = Timer
Dim Bonus As Long
Dim CombinationDrawn As Range
Dim CombinationToCheck As Range
Dim Matched() As Long
Dim NonBonus As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Sheets("Macro Program").Select

For Each CombinationToCheck In Range(Cells(8, 11), Cells(Rows.Count,
11).End(xlUp))
Erase Matched
ReDim Matched(0 To 7)
For Each CombinationDrawn In Range(Cells(8, 3), Cells(Rows.Count,
3).End(xlUp))
NonBonus = Evaluate("Sum(Countif(" & CombinationToCheck.Resize
(1, 6).Address & _
"," & CombinationDrawn.Resize(1, 6).Address & "))")
Bonus = Evaluate("Countif(" & CombinationToCheck.Resize(1,
6).Address & _
"," & CombinationDrawn.Offset(0, 6).Address & ")")
If NonBonus = 6 Then
Matched(7) = Matched(7) + 1
ElseIf NonBonus = 5 And Bonus = 1 Then
Matched(6) = Matched(6) + 1
Else
Matched(NonBonus) = Matched(NonBonus) + 1
End If
Next
CombinationToCheck.Offset(0, 7).Resize(1, 8).Value = Matched
Next

Range("A1").Value = Format(((Timer - Start) / 24 / 60 / 60),
"hh:mm:ss")

Range("B1519").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

--
HTH,
Bernie
MS Excel MVP


"Paul Black" wrote in message
...
On Oct 15, 1:20 pm, Paul Black wrote:
Good afternoon,

This code worked fine until I inserted an extra column at the very
front of my data (column "A" is blank, added column "B", data now
starts in column "C" instead of column "B")
How can I change it so it still works although EVERYTHING has moved
one column to the right.
Thanks in advance.

Paul


Sorry, would help if I put the code ...

Option Explicit
Option Base 1

Sub Multiple_Combination_Checker_PAB()
Dim Start As Double
Start = Timer
Dim Bonus As Long
Dim CombinationDrawn As Range
Dim CombinationToCheck As Range
Dim Matched() As Long
Dim NonBonus As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Sheets("Macro Program").Select

For Each CombinationToCheck In Range(Cells(8, 10), Cells(Rows.Count,
10).End(xlUp))
Erase Matched
ReDim Matched(0 To 7)
For Each CombinationDrawn In Range(Cells(8, 2), Cells(Rows.Count,
2).End(xlUp))
NonBonus = Evaluate("Sum(Countif(" & CombinationToCheck.Resize
(1, 6).Address & _
"," & CombinationDrawn.Resize(1, 6).Address & "))")
Bonus = Evaluate("Countif(" & CombinationToCheck.Resize(1,
6).Address & _
"," & CombinationDrawn.Offset(0, 6).Address & ")")
If NonBonus = 6 Then
Matched(7) = Matched(7) + 1
ElseIf NonBonus = 5 And Bonus = 1 Then
Matched(6) = Matched(6) + 1
Else
Matched(NonBonus) = Matched(NonBonus) + 1
End If
Next
CombinationToCheck.Offset(0, 7).Resize(1, 8).Value = Matched
Next

Range("A1").Value = Format(((Timer - Start) / 24 / 60 / 60),
"hh:mm:ss")

Range("B1519").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

.... Thanks, Paul


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Help with Columns

On Oct 15, 2:24*pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Sub Multiple_Combination_Checker_PAB()
Dim Start As Double
Start = Timer
Dim Bonus As Long
Dim CombinationDrawn As Range
Dim CombinationToCheck As Range
Dim Matched() As Long
Dim NonBonus As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Sheets("Macro Program").Select

For Each CombinationToCheck In Range(Cells(8, 11), Cells(Rows.Count,
11).End(xlUp))
* * Erase Matched
* * ReDim Matched(0 To 7)
* * For Each CombinationDrawn In Range(Cells(8, 3), Cells(Rows.Count,
3).End(xlUp))
* * * * NonBonus = Evaluate("Sum(Countif(" & CombinationToCheck..Resize
(1, 6).Address & _
* * * * * * "," & CombinationDrawn.Resize(1, 6).Address & "))")
* * * * Bonus = Evaluate("Countif(" & CombinationToCheck.Resize(1,
6).Address & _
* * * * * * "," & CombinationDrawn.Offset(0, 6).Address & ")")
* * * * If NonBonus = 6 Then
* * * * * * Matched(7) = Matched(7) + 1
* * * * ElseIf NonBonus = 5 And Bonus = 1 Then
* * * * * * Matched(6) = Matched(6) + 1
* * * * Else
* * * * * * Matched(NonBonus) = Matched(NonBonus) + 1
* * * * End If
* * Next
* * CombinationToCheck.Offset(0, 7).Resize(1, 8).Value = Matched
Next

Range("A1").Value = Format(((Timer - Start) / 24 / 60 / 60),
"hh:mm:ss")

Range("B1519").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

--
HTH,
Bernie
MS Excel MVP

"Paul Black" wrote in message

...
On Oct 15, 1:20 pm, Paul Black wrote:

Good afternoon,


This code worked fine until I inserted an extra column at the very
front of my data (column "A" is blank, added column "B", data now
starts in column "C" instead of column "B")
How can I change it so it still works although EVERYTHING has moved
one column to the right.
Thanks in advance.


Paul


Sorry, would help if I put the code ...

Option Explicit
Option Base 1

Sub Multiple_Combination_Checker_PAB()
Dim Start As Double
Start = Timer
Dim Bonus As Long
Dim CombinationDrawn As Range
Dim CombinationToCheck As Range
Dim Matched() As Long
Dim NonBonus As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Sheets("Macro Program").Select

For Each CombinationToCheck In Range(Cells(8, 10), Cells(Rows.Count,
10).End(xlUp))
* * Erase Matched
* * ReDim Matched(0 To 7)
* * For Each CombinationDrawn In Range(Cells(8, 2), Cells(Rows.Count,
2).End(xlUp))
* * * * NonBonus = Evaluate("Sum(Countif(" & CombinationToCheck..Resize
(1, 6).Address & _
* * * * * * "," & CombinationDrawn.Resize(1, 6).Address & "))")
* * * * Bonus = Evaluate("Countif(" & CombinationToCheck.Resize(1,
6).Address & _
* * * * * * "," & CombinationDrawn.Offset(0, 6).Address & ")")
* * * * If NonBonus = 6 Then
* * * * * * Matched(7) = Matched(7) + 1
* * * * ElseIf NonBonus = 5 And Bonus = 1 Then
* * * * * * Matched(6) = Matched(6) + 1
* * * * Else
* * * * * * Matched(NonBonus) = Matched(NonBonus) + 1
* * * * End If
* * Next
* * CombinationToCheck.Offset(0, 7).Resize(1, 8).Value = Matched
Next

Range("A1").Value = Format(((Timer - Start) / 24 / 60 / 60),
"hh:mm:ss")

Range("B1519").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

... Thanks, Paul


Thanks Bernie,

It works brilliantly!
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
Make Columns A&B on Sheet2 always equal Sheet1 table columns A&B KnightBall Setting up and Configuration of Excel 6 August 18th 09 05:48 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 2 July 31st 06 09:45 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM
Excel 2007 extra columns - but transposing columns still not working! [email protected] Excel Programming 0 July 26th 06 02:58 PM
Excel button :: Filter columns by value - possible? Additionally, hide certain columns No Name Excel Programming 4 December 28th 04 07:44 PM


All times are GMT +1. The time now is 03:56 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"