UserForm - Mirror values in sheet - Indirect cell reference

Moortwig

New Member
Joined
Feb 24, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Hi,

Backstory:
I'm trying to make a UserForm with a listbox ("cboUtrymme_01") that picks the list based on a reference inside a cell. On top of that I'm trying to retrieve the reference based on the value inside a combobox called "cbo_ID01".
What I'm trying to do is to mirror what I'm doing in the UserForm with the corresponding cells in my Excelsheet. This means I can go back to registered posts and edit them, and the values/options inside the UserForm change in realtime, and whitout pressing save.

The issue:
The main issue here is that I'm a rookie when it comes to VBA... I've managed to get the values to mirror eachother sometimes, but I haven't managed to solve how the previous picked value in "cboUtrymme_01" is shown when I open the UserForm back up after closing it. This leads to the corresponding cell being empty unless I choose it again. I can see that the code has some logical issues, but I just don't have the knowledge to fix it.

I'd apprechiate any help I can get.


What I've done so far:
The content of cell AJxx is a cellreference to a list (1_1!D85:D94). This reference will be decided based on what I pick in another listbox that's yet to be programmed...
cboID_01 has the value one in the picture below
cboUtrymme_01 contains the list (3a, 3b, 3c...) and is picked up by the content of cell AJxx

Here's my code so far

VBA Code:
Private Sub cboID_01_Change()

Dim i As Long, Lastrow As Long
    Lastrow = Sheets("Master_01").Range("C" & Rows.Count).End(xlUp).Row

    For i = 2 To Lastrow
    If Sheets("Master_01").Cells(i, "C").Value = (Me.cboID_01) Or _
    Sheets("Master_01").Cells(i, "C").Value = Val(Me.cboID_01) Then
    
    Me.cboUtrymme_01 = Sheets("Master_01").Cells(i, "D").Value
    Me.cboUtrymme_01.RowSource = Sheets("Master_01").Cells(i, "AJ").Value
    
    Sheets("Master_01").Cells(i, 3).Value = Me.cboID_01
    Sheets("Master_01").Cells(i, 4).Value = Me.cboUtrymme_01
    
    
    End If
    Next

End Sub

UserForm_Image_01.JPG
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,215,786
Messages
6,126,891
Members
449,347
Latest member
Macro_learner

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top