myrange

  1. A

    Error Handler to check for not data found

    I have this code that I want to display if no data is found, however it does not work as expected. What can be the problem? Thanks Dim myRange As Range Rng.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("AT14:AV15"), Unique:=False On Error Resume Next Set myRange =...
  2. R

    Copy + Rename from Hidden Sheet

    Hello, I'm using the code below to copy and rename worksheets. However i what the sheets that I copy from to be hidden. When I hide those sheets and try to copy i get an error. What code needs to be added? [code] Sub AutoAddSheet() Dim MyCell As Range, MyRange As Range Set MyRange =...
  3. S

    Set Range to Last Row With Data

    I have a combobox that gets values autofilled and sorted from Column "A". Currently it looks at rows 15 to 80. How do I modify my code to search to the last row with data? Dim myRange As Range Set myRange = Sheets("Sheet1").Range("A15:A80") With Sheets("Sheet1").Sort...
  4. E

    Count and warn if number is exceeded

    Hi folks. I am setting up an invigilation roster in which an educator can only be assigned once per day per room. If you attempt to assign the educator again for the same day, then Excel needs warns you and delete your second assignment of the educator. I can do this for one day, and it works...
  5. M

    Excel VBA speed up code to hide rows/delete color

    I am using following code to delete color and hide rows that include several criteria before exporting sheets to pdf's. Is there any way to speed up this process as it is taking quite a lot of time to process. Especially in situations when I have several sheets in one workbook and to apply this...
  6. M

    Help with Named Ranges in VBA

    I have been using Named Ranges in VBA for years, but recently it gives me a runtime error when there is a formula in a named range. If I put the formula Sum (b1:c1) in A1 and refer MyRange to A1 it works fine in VBA. However when I put the formula Sum (b1:c1) directly in to MyRange I get a run...
  7. K

    Background colour of cells to change based on value.

    Hello, I have a document (shared) which we use as a calendar and to keep track of people and where they are. It has all 365 day on it and with over 100 people. I would like a vba to search the document and change the cell colour based on the value. For example: Red if someone is away on...
  8. I

    Combining two codes

    Evening, I have this code in use, Private Sub Worksheet_Change(ByVal Target As Range) With Target If .Column = 7 Then Exit Sub If .Count = 1 And Not .HasFormula Then Application.EnableEvents = False .Value = UCase(.Value)...
  9. M

    Help

    I found the following code which looks as though it will do what i want. Private Sub mulholm() Dim myRange As Range Dim myCell As Range Set myRange = Range("B15:B16") For Each myCell In myRange If myCell Like "*Department Total*" Then myCell.Font.Bold = True End If Next myCell End Sub This...
  10. J

    VBA to Loop through columns and hide columns totaling zero(0)

    Hi , I want to loop through my columns and hide all columns wherethe total value is 0. The column range is (A:AEN) & the data begins from row 4 – to last row ( Lastrow is never the same and will always be based on last cell populated on columnA) The columns can contain text, dates...
  11. S

    Use a cell as the range in my VBA

    Trying to use the contents of D% as my range when running the below MACRO. Not clear why the below will not work. Sub TLANE_ERROR_Summary_Update() ' TLANE_ERROR_Summary_Update Macro Call CLEARTLANE Dim cl As Range Dim myRange As Range Set myRange = Range("D5") For Each cl In...
  12. I

    Coloring active cell & rows existing code edit

    I use the following code to high light rows & active cells etc. My range is A-G & currently row`s 3-28 How can this code be altered so if the row 29 or 30 is selected then the Interior cell color & active cell turn Red Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim...
  13. I

    Merge 2 codes into 1

    Hi, Can you please advise the way to merge the following codes. Then i will have the 1 button the press to run both codes. Many Thanks for all your help. Sub LEADERBOARD() '' leaderboard Macro' Range("C1:F17").Copy Range("I1") Worksheets("HONDA SHEET").Range("C1:D17").Copy...
  14. I

    Set my range help please

    Evening, I have the code installed below but need advice for the correct way to writ something if i may ask. The part im stuck with is Set my Range, the sheet is called SOLD ITEMS & the range is C2:C35 Thanks Private Sub CommandButton1_Click()Dim myData Dim myStr As String Dim x As Integer...
  15. M

    Set Range for VLOOKUP

    Hi Im trying to set a range to be used in a VLOOKUP function. I cant figure out why this isn't working... The RowCount variable is holding an Integer. Dim MyRange as Range Set MyRange = Worksheets("Anysheet").Range(Cells(2, 2), Cells(RowCount,5)) Thank you in advance.
  16. P

    VBA VLOOKUP returning zero value due to data type mismatch.

    Hi, am using below function and always getting value zero for . i even tried changing cell formats for datarange, when i do that i get 13 type mismatch error. please help. If Trim(CStr(TextBox_itemcode.Text)) <> "" Then myitval = mylookup(Trim(CStr(TextBox_itemcode.Text)))...
  17. A

    Evaluate formula using a variable as range

    I am trying to evaluate a formula with this code Sub test() Dim myRange As Range Set myRange = Worksheets("Sheet1").Range("A1:B10") 'answer = Application.WorksheetFunction.Max(myRange) answer = [SUMPRODUCT((LEN(myRange)>0)*1)] MsgBox answer End Sub But I getting an error...
  18. C

    copy range in respecting row

    I have data something llike this a b c d e f g h i j k l 1 2 1 1 1 10 21 23 32 34 43 45 3 11 2 0 22 33 44 4 12 3 1...
  19. D

    Assigning Range gives Run-time error '91'

    The line which sets MyRange gives the error with the detail of "Object variable or With block variable not set." I'm hoping that there is simply a typo or something easy I'm missing. And any tips on a better way to do this sort (or if it will even work once I get past the error LOL) would be...
  20. B

    Copying Cells with a Partial String

    I have a macro where I'm trying to cut rows out of one sheet and place in another based on a partial data string in the cell. Data: <tbody> 1111-1000-8 1111-1001-8 1111-2000-8 1111-2000-8 1111-2001-8 </tbody> Code: Sub Macro1()' Dim myrange As Range Dim myvalue As String myvalue...

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