robertmwaring2
Board Regular
- Joined
- Mar 8, 2019
- Messages
- 132
- Office Version
- 365
- Platform
- Windows
I am unable to find a solution that works for this in previous threads - hoping I will get lucky and someone can assist me.
This is my workbook
It has a few forms in that that the user either enters or selects data. One form uses data from another form but ultimately all the data ends up in the same worksheet. I have this bit of code (below) that I was excited worked until I attached it to a button on one of the forms.
Basically what is happening is based upon user inputs, the data in Table1 on Sheet3 is filtered, some additional info is added, etc. When I click the button (badd) on the userform (UFADD), I am trying to apply one last filter to the data, and copy 4 of the columns ([Ingredient], [Total], [UOM], [Notes]) to sheet5 in the same workbook. When I initially was working through this to get it together, I simply "Sheet3.Range("Table1[INGREDIENT]").Select", which seemed to work fine in a module but does not when attached to the button. I found some resources that suggest using the following iteration "Sheet3.Range("Table1[Ingredient]").SpecialCells(xlCellTypeVisible).Select" but it does not appear to work either. Can anyone assist?
This is my workbook
It has a few forms in that that the user either enters or selects data. One form uses data from another form but ultimately all the data ends up in the same worksheet. I have this bit of code (below) that I was excited worked until I attached it to a button on one of the forms.
VBA Code:
Dim LR As Long
LR = Sheet5.Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheet5.Range("A" & LR).Value = LBDISPLAY.Caption
Sheet3.Range("Table1[INGREDIENT]").Select
Selection.Copy
Sheet5.Range("A" & LR).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Sheet3.Range("Table1[TOTAL]").SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheet5.Range("B" & LR).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Sheet3.Range("Table1[UOM]").SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheet5.Range("C" & LR).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Sheet3.Range("Table1[NOTES]").SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheet5.Range("D" & LR).PasteSpecial Paste:=xlPasteValues
Basically what is happening is based upon user inputs, the data in Table1 on Sheet3 is filtered, some additional info is added, etc. When I click the button (badd) on the userform (UFADD), I am trying to apply one last filter to the data, and copy 4 of the columns ([Ingredient], [Total], [UOM], [Notes]) to sheet5 in the same workbook. When I initially was working through this to get it together, I simply "Sheet3.Range("Table1[INGREDIENT]").Select", which seemed to work fine in a module but does not when attached to the button. I found some resources that suggest using the following iteration "Sheet3.Range("Table1[Ingredient]").SpecialCells(xlCellTypeVisible).Select" but it does not appear to work either. Can anyone assist?