January 18, 2020, 10:22 am
I am having an issue with creating macros in my sheet. The macros individually work, I am just trying to assign buttons to them. And maybe I am going about this all the wrong way, one macro to show certain cells, another macro to hide them - not sure if that can be done with one macro but then I am new to macros.
However, with the technique I am using, the two macros individually work. But the buttons will/will not work. In example, below:
Code:
Private Sub ToggleButton36_Click()
If ToggleButton36.Value = True Then
Call Y4BHPSO2
Else
Call N4BHPSO2
End If
End Sub
Code:
Private Sub ToggleButton39_Click()
If ToggleButton39.Value = True Then
Call Y4HPSO2
Else
Call N4HPSO2
End If
End Sub
The first button works, the second button does not work. I have this all throughout my sheet, currently have 43 buttons with about half of them working and half of them not working. When they do not work, it tells me "Compile Error. Sub or Function not defined." But the Sub values are identical, why would one work and other does not?
The macros for these buttons are here:
Code:
Sub Y4BHPSO2()
'
' Y4BHPSO2 Macro
'
'
Rows("72:72").Select
Selection.EntireRow.Hidden = False
ActiveSheet.Range("A1").Select
End Sub
Sub N4BHPSO2()
'
' N4BHPSO2 Macro
'
'
Rows("72:72").Select
Selection.EntireRow.Hidden = True
ActiveSheet.Range("A1").Select
End Sub
Sub Y4HPSO2()
'
' Y4HPSO2 Macro
'
'
Rows("73:73").Select
Selection.EntireRow.Hidden = False
ActiveSheet.Range("A1").Select
End Sub
Sub NHPSO2()
'
' N4HPSO2 Macro
'
'
Rows("73:73").Select
Selection.EntireRow.Hidden = True
ActiveSheet.Range("A1").Select
End Sub
↧
January 18, 2020, 10:27 am
Maybe I am do not have the best way to go about this, but, what I have:
Code:
Sub YDSCFM()
'
' YDSCFM Macro
'
'
Sheets("Summary").Select
Range("50:50,110:110").Select
Selection.EntireRow.Hidden = False
Sheets("RATA").Select
Range("AA36:AB49").Select
Selection.Cut
Range("E36:F49").Select
ActiveSheet.Paste
Sheets("Flow").Select
Rows("1:42").Hidden = False
Sheets("RATA").Select
ActiveSheet.Range("A1").Select
End Sub
Sub NDSCFM()
'
' NDSCFM Macro
'
'
Sheets("Summary").Select
Range("50:50,110:110").Select
Selection.EntireRow.Hidden = True
Sheets("RATA").Select
Range("E36:F49").Select
Selection.Cut
Range("AA36:AB49").Select
ActiveSheet.Paste
Sheets("Flow").Select
Rows("1:42").Hidden = True
Sheets("RATA").Select
ActiveSheet.Range("A1").Select
End Sub
My problem is, if this macro gets toggled backwards then I have to recreate the range of cells being cut and paste because it will cut and paste blank cells over that range.
First off, perhaps I am going about this backwards by having two macros, instead of one macro being a toggle.
Second, what would be the coding to tell it that if values are in a range of cells then do not paste over those cells and instead stop the macro?
↧
↧
January 18, 2020, 12:33 pm
The text boxes - color ID by Type
The Scenario:
Multiple Text Boxes, all with an identical preselected shape
Each Text box displays a cell-referenced Letter value (A, B, C, etc.)
The project sheet has 600 of these shaped text boxes
Each letter value is assigned a specific color for the backcolor
Currently the backcolor is manually changed based on the letter value, one text box at a time
I attempted to do this backcolor change automatically using the Assign Macro Option (select text box, right click, select Assign Macro)
Here is the Code I generated, and the error message:
________________________________________________________________________________________________
Sub AutoShape3_Click()
Private Sub AutoShape3_Change()
Select Case AutoShape3.Value
Case "A": AutoShape3.BackColor = RGB(255, 0, 0)
Case "B": AutoShape3.BackColor = RGB(0, 255, 0)
Case "C": AutoShape3.BackColor = RGB(0, 0, 255)
Case Else: AutoShape3.BackColor = RGB(0, 0, 0)
End Select
End Sub
______________________________________________________________________________________________________________________________
Error Message:
Compile Error: Expected End Sub (with the top line yellow-highlighted)
Any suggestions?
A small sample file is attached.
↧
January 18, 2020, 1:03 pm
Can a toggle button be coded to hide/unhide other toggle buttons? Not by hiding rows containing the buttons though.
↧
January 18, 2020, 1:59 pm
I have relatively large Excel Data Sheet 5000 Rows and 35 Columns - Grows by 1 column each week for comments added
The data is set as a Table and One of the Columns has a number of different References in it
example
AA99/99AA
AB95/64AB
AE64/32AC
Etc....
Some of the Rows will be the same ref a number of times with Tasks against them for different People.
What i am trying to do is ......
Create an Button that will launch an Input Box that will allow me to Paste in a number of these References that will then set the filter on the main sheet and display only tasks against these References
I assume i need to create an input Box that will allow multiple lines to be pasted in and the code will store it as an array and then use this array to set the filter on the main table
Any code ot tips would be gratefully received
Thank you for your time reading this
Richard
↧
↧
January 18, 2020, 5:57 pm
Hi guys,
Do you know how i can convert this cell address to a range so that i can access the cells' properties and methods :
Set foundRng = Sheet11.Range("b1:b27").Find(Sheet10.ComboBox1.Text)
Set addCell = Worksheets("Speaking Total").Range(foundRng.Address(RowAbsolute:=False))
foundRng.Address // i attained this address from the "Speaking Total" worksheet after it matched a value in a combobox.
I just want to be able to access the "foundRng.Address" like a normal cell range.
Thanks
↧
January 18, 2020, 6:26 pm
Hi everyone,
I have a combobox with ship names, added through the AddItem function.
Currently I have to type the exact match in the combobox to get to the ship name I am looking for.
Is there a way just to type a part of the ship name and it will show the ship name?
Example:
Ship name is King Admiral III, I enter Admiral in the combobox, King Admiral III will come up.
Thanks for your help.
↧
January 18, 2020, 6:33 pm
I have this Excel file with numbers in them (see the photo). The file has anagrams of a certain number sequence - as in this photo:
Untitled_zpsgpoc7yfo.jpg
Say, I know that the number sequence 4 1 2 4 0 2 has "anagrams" of it in the said file.
Is there a way to search for those anagrams and highlight them all? (As I manually depicted those in the attached photo
) Here it is again if you want to refer to it:
Untitled_zpsgpoc7yfo.jpg
Pardon that Im not very much of a programmer. I know that there are related topics on anagrams in this forum but I cant make much out of the code to modify for this concern.
I hope that the programmers here can help for people with the same problem as I have
↧
January 18, 2020, 8:12 pm
Say, I have a row of 10 data. I calculate the std deviation using stdev function on the 5th, 6th, 7th, 8th, 9th and 10th data.
A month later I add 11th data to that row. How can I set it up such that the stdev will automatically select the LAST 6 data (ie 6th, 7th, 8th, 9th, 10th and 11th data)?
Thanks.
↧
↧
January 18, 2020, 8:32 pm
Hi All,
I have a difficult question on hand. Please see the attached excel example.
Background
In the attached excel, it shows 31 days in Jan 2020. The numbers (B2:AF4) represent the number of dutuies in each calender date.
Rules
According to company rules:
1.a person can have more than 1 duties on the same day
2.a person cannot work for 7 consecutive days
Questions
What excel function/VBA code can help to attain the below listed results? I willl use 1 person (Anna) to illustrate:
- Check the values from 1 Jan to 7 Jan (B2:H2)
- if there is one cell's value is not equal to to 0, then pop up message box "7 consecutive working days"
- if is at lease one cell's value equal to 0, then continue to check the values from 2 Jan to 8 Jan (C2:I2)
- The last checking process should end after checking the cell's value from 25 Jan to 31 Jan
Thanks for your input
↧
January 18, 2020, 9:02 pm
Hi,
I want to scrape linkedin profile..
i want any example how to extract using API..
Can anyone help with respect to this?
↧
January 19, 2020, 7:42 am
I'm trying to purge unnecessary characters from 40K lines of data.
The characters I need to remove are always at the front of the line but vary in length and type.
Here are a few examples:
501-* EASED OR
1366-DECISIONS
5874-*2 or 3
Some are "-*", other are just "-".
I need to remove everything from the front including the dash and/or asterisk.
Is this possible?
Any suggestions would be greatly appreciated!
Sick
↧
January 19, 2020, 8:24 am
Trying to add a code through VBA to allow multiple options in drop down- However not working??? any suggestons
↧
↧
January 19, 2020, 8:39 am
This is not a concrete coding question, I just would like to know if anyone has managed to connect to an aws (or even azure) database from excel via ODBC connection? Is it possible?
Thank you
↧
January 19, 2020, 8:49 am
Hi,
Currently I am using slicer, which is controlling about 30 pivot tables that are linked to external source.
The refresh of these tables is taking few minutes and sometime some of the tables cannot be refreshed due to different issues.
Can I add some dialog box the status of the refreshing? For example to show how many tables out of total have been updated in each moment. In that case I can understand which table cannot be updated and also will be nice to see what is the status of refreshing.
Thank you in advance!
↧
January 19, 2020, 9:16 am
Hi All
In H5:H300 I have text in the form
09/07/2018..... (F32)
25/04/2018..... (F37)
03/05/2018..... (F40)
11/01/2017..... (F44)
12/06/2020..... (F32)
16/04/2018..... (F46)
26/05/2018..... (G59)
18/04/2020..... (F7)
04/07/2019..... (F62)
05/01/2019..... (F3)
I'm trying via VBA to put these in order from earliest date to latest.
So the above would become :
11/01/2017..... (F44)
16/04/2018..... (F46)
25/04/2018..... (F37)
03/05/2018..... (F40)
26/05/2018..... (G59
09/07/2018..... (F32)
05/01/2019..... (F3)
04/07/2019..... (F62)
18/04/2020..... (F7)
12/06/2020..... (F32)
I don't know if it's a complicating factor but H5:H300 are merged with their neighbours in column I. All the relevant cells have General formatting.
Grateful for any advice.
↧
January 19, 2020, 9:53 am
Dear Pros,
I have an existing file where I have a code which runs everytime when a cellvalue is changed. it works as it should.
I have a functioning code which runs when a button is clicked.
(both codes are under sheet "Suche". the called sub should be "suchenMitVBA22 )
I wanted the code with the button to be executed when a range value is changed but I do not succeed...
My attempts are commented out in the code.
Can anyone tell me what I am doing wrong?
thank you for your help!
↧
↧
January 19, 2020, 10:10 am
Hello,
I can't get a checkbox in Excel to work. I know little VBA and can't figure out the code to accomplish what I need.
I have the Checkbox (Form Control) on the sheet and I created a UserForm to enter some data in it.
What I want is that when I check the box, it loads the user form.
I tried putting code in a module and linking the box to it, but it threw an error about a variable not set.
I don't know how to proceed.
This is what I used to open the form:
Code:
Load AgentForm
AgentForm.Show
Any help will be appreciated.
Thank you.
↧
January 19, 2020, 10:45 am
Hello I am trying to save a workbook, with a filename created by fields in a userform
the code I have is
Code:
nwb.SaveAs Filename:="C:\Users\Chris' Laptop\Desktop\&Me.txtcustname.value.xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
Any help provided much apreciated
↧
January 19, 2020, 11:39 am
Dear Sir / Madam,
I calculate some values in Spreadsheet A of a Workbook and copy the values only to spreadsheet B in the same workbook using a macro. On the second or subsequent time in which I use the macro to place the newer data in the same location in spreadsheet B by deleting some cells in rows and columns to the left of where the current data is to be stored the macro immediately shows a run-time error. The cells being removed are blank cells with no formulas or values or formatting. The first time I run the macro it works. Upon running it the second time it immediately opens a message which states Run-time error 1004 You cant change part of an array.
I am running the Excel spreadsheet on Windows 10, Excel 2016.
None of the following work to solve the problem:
I cannot find any GWXL97.DLA file;
Edit Copy and Edit Paste of the highlighted cells into the same location as the cells to be deleted;
Changing the macro to a different group of unformatted empty cells to remove produces the same error message;
The trust settings for macros in Excel are open and macros enabled;
Find & Select, Go to Special and Current Array says that no cells are found;
Home and Clear Button, Clear Formats has no effect;
F2, CTRL +X, select new location CTRL +V, CTRL+Shift + enter have no effect.
Following is the initial code section text where the problem occurs:
Application.Goto Reference:="R5C2"
Range("B5:X130").Select
Selection.Delete Shift:=xlToLeft
Application.Goto Reference:="R5C1543"
Range("BGI5:BHI130").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Application.Goto Reference:="Model!R[-2]C[-1538]"
How do I remove the error message or simply bypass it as it has no meaning or use?
Many thanks in advance for your assistance.
Best Regards,
Michael
Your Message
↧