I'm new to VBA.
Currently, we are conducting physical fitness tests for various items and entering the next measurement time in the FS cell.
From here, I would like to autofilter only those that have a specific month (for example, January) and copy them to another sheet. I took a look and wrote the code as below.
Sheets ("Sheet3"). Select Dim Filter_Month Dim Criteria_Month Dim Target As Range, LastCell As Range Set Target = Sheets ("Basic evaluation next measurement"). Cells (Rows.Count, 1) .End (xlUp) .Offset (1, 0) Filter_Month = InputBox ("Enter the month I want to extract") Select Case Filter_Month Case "1" Criteria_Month = xlFilterAllDatesInPeriodJanuary Case "2" Criteria_Month = xlFilterAllDatesInPeriodFebruray Case "3" Criteria_Month = xlFilterAllDatesInPeriodMarch Case "4" Criteria_Month = xlFilterAllDatesInPeriodApril Case "5" Criteria_Month = xlFilterAllDatesInPeriodMay Case 6 Criteria_Month = xlFilterAllDatesInPeriodJune Case "7" Criteria_Month = xlFilterAllDatesInPeriodJuly Case "8" Criteria_Month = xlFilterAllDatesInPeriodAugust Case "9" Criteria_Month = xlFilterAllDatesInPeriodSeptember Case "10" Criteria_Month = xlFilterAllDatesInPeriodOctober Case "11" Criteria_Month = xlFilterAllDatesInPeriodNovember Case "12" Criteria_Month = xlFilterAllDatesInPeriodDecember End Select Range ("A1"). AutoFilter field: = 175, Criteria1: = Criteria_Month, Operator: = xlFilterDynamic Range ("A1"). CurrentRegion.SpecialCells (xlVisible) .Copy Target ActiveSheet.AutoFilterMode = False End Sub
When I run it, it gets stuck at the Range method.
I'm stuck, so I'd like to ask a professor.
Answer # 1
Range.Autofilter doesn't seem to be supported on Mac.
Range.AutoFilter method (Excel)
Excel for Mac does not support this method.
Similar methods for Selection and ListObject are supported.
Because there is
Range ("A1"). CurrentRegion.Select Selection.AutoFilter field: = 175, Criteria1: = Criteria_Month, Operator: = xlFilterDynamic
Why don't you try it like this?
I'm sorry if I make a mistake because there is no environment that can be tested immediately.
Answer # 2
On our side, as long as you specify 1 to 12, no error will occur.
If you specify a value other than 1 to 12, the same error will occur. .. ..
The difference from the questioner's code is that the FS column (Fields: = 175) is set to the A column (Fields: = 1) and the date is set in the A column.
Does Criteria_Month have the correct value in Range in step execution?
- excel vba extraction method from specific characters to blank lines
- i want to delete from a specific character to the end of the sentence in vba
- vba want to retrieve a specific cell in the clicked row
- posting with vba autofilter and conditional branch
- copying a specific sheet in a workbook containing a macro in excel vba causes the macro to be transferred to a specific sheet
- i want to extract only the one that has a specific value in column a from multiple cells with vba
- vba:i want to paste a specific range of values into the body of an outlook email
- i want to copy a specific sheet to another file with vba
- vba - i want to search for a specific value and delete the value entered in all applicable cells
- vba - in msaccess, i want to make a specific column a hyperlink when pulling data from mysql using odbc datalink
- excel vba:i want to color a specific range at a specific cell change event
- vba - macro to extract rows containing specific words and output to another worksheet
- vba - i want to display the last day of the newest month from multiple dates
- vba - post specified value to specific cell range
- i want to search for a word filled with a specific color with vba in word and highlight it with a highlighter
- when an email with a specific character string in the subject of outlook vba arrives, write the text to excel
- how to convert msg files and txt files in a specific folder to pdf automatically with vba
- how to overwrite a specific cell after processing a vba macro
- vba - i want to pass an argument to a specific method of a powershell com object and execute it
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory