Utilise ShowDataForm Excel but hide data - excel

I have attempted the solution previously posted
https://stackoverflow.com/a/31642837/6463950
but whilst this code works nicely it doesn't get round the issue of wanting to have the database hidden from the user view. Has anyone determined a way to do this?
I am using the following code. If I hide the worksheet or hide the columns on TimeCapture then I get a runtime error '1004'
Sub OrderEntry()
Sheets("TimeCapture").Select
Range("a1").CurrentRegion.Name = "database"
ActiveSheet.ShowDataForm
End Sub

There is no need to select or active the sheet. You can even have the worksheet hidden.
Use:
Sheets("TimeCapture").ShowDataForm

Related

Drop down menu - data validation - looking for source

I have been wracking my brain and I’ve lost all will to work (yay!) I have a spreadsheet (wow!) with a drop-down menu and want to remove the drop down list – start new/fresh - however in the validation data tab there is no source to “clear all” and I cannot for the life of me find the main cell that’s picking up the list - but the list is there – just no link or there is one but it’s invisible.
I can’t even create a new column to create a new drop-down because for some reason it copies the same cells over into the new column automatically so I’m stuck with the same list without being able to change it.
Am I missing something?? I can’t see any hidden rows or columns. I also have a drop-down menu where I don’t even know or can’t even see the list. The spreadsheet is not linked to any other worksheet either and it was created a while back by a person who no longer works here, so can't ask them.
Please don’t tell me I have to create a whole new spreadsheet – there is way too much data in there and it’s giving me a headache. Any assistance would be greatly appreciated and would save me from going grey prematurely.
I'm using Windows 10 pro and Excel 2016.
Excel Method:
Data - Data Tools - Data Validation - Settings tab - Clear All.
VBA Method (One sheet):
Option Explicit
Sub Clear_Validation()
With ThisWorkbook.Worksheets("Sheet1")
.Cells.Validation.Delete
End With
End Sub
VBA Method (Loop sheets):
Option Explicit
Sub Clear_Validation()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
With ws
.Cells.Validation.Delete
End With
Next ws
End Sub

VBA Run-Time error '9' (Subscript out of range) on transfered in worksheet

This is my first post and I new to programming in VBA. I have a large excel file where I am trying to create a macro to delete multiple tabs. My code is as followed it works as I am prompted with a do I wish to permanently delete:
Option Explicit
Sub delSheet()
Worksheets("sheet2").Delete
End Sub
However when I transfer in a tab (tab name is "sheet92') from another file I get this error using the same code
Option Explicit
Sub delSheet()
Worksheets("sheet92").Delete
End Sub
What is causing the code to delete the sheet2 which is the tab that I created within opening a .xlsb file and creating a new sheet vs. the error message on copying into the file from an existing file? Thank you advance for your help.
Your question is not very clear, but you probably have to reference the correct workbook, like this:
Workbooks("file.xlsx").Worksheets("sheet92").Delete
If the workbook is not already active, giving only Worksheets("sheet92") won't work.
I solved my first progroamming bug! I was using the wrong name, I was using the field (name) vs. the actual name of the tab, I took a screen capture here !http://imgur.com/a/bPNkg! once I used name Sheet1 I was able to delete. Thank you for your help #cub

Macro for calculating specific cells

I am trying to make a button so I can recalculate a certain area inside of my worksheet. However after having looked at several tutorials I cannot figure out what I am doing wrong.
Here is my code:
Sub ReloadPlanet()
Worksheets("Sheet1").Range("E9:H27").Calculate
End Sub
Any feedback as to what I am doing wrong?
edit
Here is a bit more detail on the sheet itself:
Each of the commands I want refresh are VLOOKUP commands

Userforms causing excel 2013 to crash

I have the following issue:
I create a userform in excel 2013 and add for starters one text box to show the date and right underneath a combobox which is reflecting a data validation list.
As soon as i write the code
Private Sub UserForm_Initialize()
Me.tbDate = Date
'fill combobox
For Each cell In [cartridges]
Me.cmbCartridges.AddItem cell
Next cell
End Sub
Can anyone help pretty please?
Thanks in advance
The code should work. I am running Excel 2013 as well and just tested your code with no problems.
Two things to check.
1
Make sure that the defined name is spelled exactly the same way in the VBA code as it is in the Name Manger.
2
Make sure that the defined name does not evaluate to an error.

VBA Excel dataform not displaying the right input and fields

I have the following VBA code, which should show a dataform from another hidden sheet.
Sub CoverageBssEntry()
Application.ScreenUpdating = False
Sheets("myhiddensheet").Select
Range("myTable[#All]").Select
ActiveSheet.ShowDataForm
End Sub
When I run this, the data form does not containt the labels and inputboxes of this table.
Any help is really appreciated, because it is driving me nuts! My only other option is to spend time to build custom made user forms, while this would do perfectly.
You cannot select a hidden sheet. And anyway the .Select statements are not necessary
Try
Sheets("myhiddensheet").ShowDataForm
The fix is to use:
ActiveSheet.Cells(x,y).Select
prior calling the .ShowDataForm, works like a jiffy!
I think there are genuine constraints with the ShowDataForm command. It works fine if invoked outside of VBA while in a specific range. But once coded into VBA, it will only return the form for the first table in the referenced worksheet, even if a macro was recorded to perform that action.
I cannot tell why. Maybe because the showdataform event is tied to the worksheet and not to the table or list selected when it is called. Sorry guys. Maybe microsoft will improve this in the future.

Resources