+ Reply to Thread
Results 1 to 2 of 2

Sending data from macro to objects

  1. #1
    Registered User
    Join Date
    02-13-2020
    Location
    Poland
    MS-Off Ver
    2019
    Posts
    1

    Sending data from macro to objects

    Hello All,

    I have the problem with passing the variable from macro/module to the worksheet object. Is there anyone who can help? I found somewhere the solution, but I am not able get it at this time.

    I need to analyze CBox state only if macro Generuj() is working… / Generuj_isBusy variable. Otherwise it causes lots of unnecessary steps and takes Excel very long time to generate short list of elements.

    Macro code:

    Sub Generuj_formularz()

    Application.ScreenUpdating = False

    '***** DEKLARACJE ****

    Dim checkbox_cell As String
    Dim wiersz_sekcji, wiersz_pytania, i, j As Integer
    Dim OKA As Integer
    Dim Area As Range
    Dim Data As Variant

    End Sub

    MSExcel Objects:

    Private Sub Worksheet_Calculate()
    Application.ScreenUpdating = False

    Dim CBPrevious As CheckBox

    If ActiveSheet.Name = Me.Name And Generuj_isBusy = 1Then

    For Each CBox In ActiveSheet.CheckBoxes
    If CBPrevious Is Nothing Then

    ElseIf CBox.Caption = "NIE" And CBox.Value = 1 Then
    pozycja = CBox.TopLeftCell.Row
    Cells(pozycja, 1).Font.Strikethrough = True

    If CBPrevious.Value = 1 Then
    answer = MsgBox("Uwzgl?dnij w kalkulacji: " & Cells(pozycja, 1).Value, vbQuestion + vbYesNo + vbDefaultButton2, "Uwaga")
    If answer = vbYes Then
    CBox.Value = 0
    Cells(CBPrevious.TopLeftCell.Row, CBPrevious.TopLeftCell.Column).Select
    Else
    CBPrevious.Value = 0
    Cells(CBox.TopLeftCell.Row, CBox.TopLeftCell.Column).Select
    End If
    End If

    ElseIf CBox.Caption = "NIE" And CBox.Value <> 1 Then
    pozycja = CBox.TopLeftCell.Row
    Cells(pozycja, 1).Font.Strikethrough = False
    End If

    Set CBPrevious = CBox

    Next CBox

    End If

    End Sub
    Last edited by ad.zawadz; 03-11-2020 at 04:26 AM. Reason: Code update

  2. #2
    Forum Guru Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux
    Posts
    11,102

    Re: Sending data from macro to objects

    Administrative note

    Welcome to the forum

    in your haste to solve your problem, you probably missed the yellow banner advising how to get answers faster by posting a sheet / code ?

    Please take a moment to read it and attach a sheet accordingly.

    Thanks you for helping us help you
    Be very, very careful using IFERROR ! It hides ALL errors which is not always what you want to get correct results

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Sending activex objects to subroutine for alterations
    By paradocs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-23-2020, 07:38 PM
  2. Create macro for sending data from cell to table
    By rfiehn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2018, 08:47 PM
  3. setting up objects and extracting data from objects when of a user defined data type
    By whburling in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2017, 12:40 PM
  4. Need help with Macro sending data to new sheet
    By Vortex69 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-25-2014, 01:28 AM
  5. VBA/Macro Build for sending data to different sheets
    By derivative_x in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2011, 03:59 PM
  6. Sending emails with objects
    By ya7omar in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-09-2010, 10:31 AM
  7. Sending Excel Data Via Macro
    By RubiksCuber in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-29-2009, 01:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1