Excel VBA update entire column after event

Dear experts,

Is it possible to update an entire column on another through vba? i'm using an activex control checkbox on the sheet. From which the code should fire

thanks in advance,

Mark
LVL 1
MarkVrenkenAsked:
Who is Participating?
 
MarkVrenkenAuthor Commented:
hmmm this seems to do the trick.

ThisWorkbook.Worksheets("Deals").EnableCalculation = False
ThisWorkbook.Worksheets("Deals").EnableCalculation = True
ThisWorkbook.Worksheets("Deals").Columns("B:B").Calculate
0
 
SteveCommented:
If you want to copy one column to another in code then this is simple enough...
But I am guessing that this is not as simple as it sounds...

The following code will copy column 1 of sheet1 to column 1 of sheet2
You can then program alterations in columns or sheet as nescessary.
Thisworkbook.Sheets("Sheet1").columns(1).copy  Thisworkbook.Sheets("Sheet2").columns(1)

Open in new window

0
 
Martin LissOlder than dirtCommented:
If CheckBox1.Value = True Then
    ' Do it here
End If

End Sub

Open in new window

0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
MarkVrenkenAuthor Commented:
I'm sorry i'm an idiot!
I didn't explain what i want very well. I will try to explain what my thougts are.
I have a sheet with a checkbox. when it is checked i set the value of a cell to 1. When it is unchecked the value is 13. For simplicity sake the cell is A1 of that sheet.
The column that i want to update is based on a function i wrote. Like this. i don't have the code on this computer so forgive me if the code isn't totally correct. see below the code

Function Quartertomonth() 

select case month

case Q1
      Quartertomonth = 1
case Q2
      Quartertomonth = 2
case Q3 
      Quartertomonth = 3
case Q4
      Quartertomonth = 4
case else
       Quartertomonth = Workbooks("workbookExample").sheets("sheet1").Range("A1").Value
end select
end function

Open in new window


so when the checkbox is checked case else =1
and when the checkbox is unchecked case else =  13

So when i check/uncheck the checkbox i want to recalculate the column based on the above function. I hope you guys now can understand:)

thanks for your reply!
0
 
Martin LissOlder than dirtCommented:
Where and how is "month" defined?
Where and how are "Q1" through "Q4" defined?
0
 
MarkVrenkenAuthor Commented:
And i must add the column is on another sheet than the checkbox!
0
 
MarkVrenkenAuthor Commented:
It is defined in a table/column

Month       month numeric(this column is based on the function)
Q1                  1
Q2                  2
                  1 or 13
Q1                  1
Q4                  4
                  1 or 13
Q4                  4
                  1 or 13
Q3                  3


I want this because then i can include or exclude the blanks through the checkbox
0
 
MarkVrenkenAuthor Commented:
Workbooks(WorkbookName).Sheets("Deals").Columns("B:B").Calculate i have tried this but it doesn't seem to really recalculate it....
0
 
MarkVrenkenAuthor Commented:
Sorry for not being clear in the beginning. Luckily i found a solution of my own
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.