Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2015, 10:46 PM
NoSparks NoSparks is offline Applying a formula from a checkbox in VBA Windows 7 64bit Applying a formula from a checkbox in VBA Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default


Enter the formula you want in J4, with J4 the active cell, go to the vba immediate window and enter
Code:
? activecell.FormulaR1C1
hit enter and you'll see what the code is for that formula, except that the quotes need doubled up, have your code put this into J4 only, then use .autofill to copy down as necessary.
Reply With Quote
  #2  
Old 11-19-2015, 12:59 AM
jap7675 jap7675 is offline Applying a formula from a checkbox in VBA Windows 8 Applying a formula from a checkbox in VBA Office 2007
Novice
Applying a formula from a checkbox in VBA
 
Join Date: Nov 2015
Posts: 6
jap7675 is on a distinguished road
Default

Hi, Thanks so much for your hel - im getting really close to solving my problem.

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheets("Sheet1").Range("J4:J40").FormulaArray = "=IFERROR(INDEX(C$2:C$14, SMALL(IF($B$2:$B$14=1, ROW($B$2:$B$14)-1),ROWS(G$2:G2))),"""")"
Sheets("Sheet1").Range("J4:J40").Columns().AutoFit
ElseIf CheckBox1.Value = False Then
Range("J4:J40").Value = " "
End If

End Sub

I just need the (G$2:G2) to occur sequentially {e.g. ((G$2:G3), (G$2:G4)), (G$2:G5)) etc}when the formula is repeated across the rane. Is this possible?
Reply With Quote
Reply

Tags
check box, iferror, index



Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying styles dynamically? arkofcovenant Mail Merge 1 05-08-2015 06:02 AM
applying a style in a new document lihin Word 1 12-13-2012 05:22 AM
Applying a formula from a checkbox in VBA Applying Header to certain pages chloe.eloise Word 2 05-16-2011 12:13 AM
Help applying different margins to different pages kthomp Word 0 06-18-2010 11:37 AM
Applying And Removing Letterhead skoz55 Word 0 08-06-2009 10:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft