myrange

  1. A

    Get Column Name from Range

    If a range is Set MyRange = Application.Range("Sheet1!A2:G2") Is it possible to get the name (Header) of the column anyhow ? I tried ? MyRange(2).Name but no go.
  2. A

    Range Code Fails reading Comment text

    Just wondering why this goes to error 91 "object or with block not set" Dim MyRange as Range Dim a Set MyRange = Application.Range("Sheet1!A2:G2") a= MyRange(1).comment.text ' Set a= MyRange(1).comment.text Both 'a=' lines result in the same error 91 Thanks.
  3. Y

    Preventing/Limiting User from Deleting Data Out of Specified Range

    Hi dear, I have this code to delete data based on selection range: Sub DeleteSelection() Dim myrange As Range On Error Resume Next Set myrange = Application.InputBox(Prompt:="Select your range:", Title:="Delete Data", Type:=8) If Not myrange Is Nothing Then...
  4. J

    Solution not needed - just clarity on a piece of this code!

    Hi folks, I got the below code online somewhere a a few months back and its recently come in handy for something I'm doing (copying every other row and pasting it elsewhere). However, I'm new to VBA and do not understand 1 thing (which is a problem since I'll need to troubleshoot): why does...
  5. M

    Changing a specific cell in a Named Range

    Is it possible to change a specific cell in a named range to Bold. Example My Nmaed Range "MyRange" Refers to A1:A5 (This range is dynamic so it changes based on other cell input.) What would be the code to change A2 in MyRange to bold.
  6. D

    Conditonal Format Based On Multiple Strings

    I want to format cells as different colours based on lists of strings. For example: Format cell in MyRange as red if value equals String1 or String2 or String3 Format cell in MyRange as blue if value equals String3 or String4 or String5 Format cell in MyRange as green if value equals...
  7. A

    VBA create an array and use it in a Vlookup

    Hi, I am looking to define a list in VBA and then use that list as the range in a vlookup formula. Something like the below: MyRange = Array("AA","AB") Result = Application.VLookup(Left(A2, 2), MyRange, 1, False) The ideal results would be if whatever the first two digits of the text in...
  8. V

    find and give value in next cell - Need Simple Formula

    Hi Experts, I want below code in formula.. Pls assist.. tpa = is a word available in cell wherever i will find tpa, next cell of that should be return 1 or 0 Dim myRange As Range Dim myCell As Range rng = Range("B" & Rows.Count).End(xlUp).Row Set myRange = Range("B2:B" & rng) 'example=...
  9. I

    use code but omit specific column

    Hi, I have a working code as supplied below. It works as it should but now i require it to NOT have any action for column D Other than not having it work for that column then all is fine Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim myStartCol As String Dim myEndCol...
  10. N

    For Each MyCell In MyRange is not working in second time

    Hi Friends, I need help in vba. I have create the complied the excel files form the folder in one tab,I have done the coding the get the sub folder name list in one column , I want the coding create the tab name according the list , my coding is working fine when its run first time but after...
  11. S

    VBA to lookup value after pasting in anotherworkbook

    Ok, I have a macro that pastes data into a new or existing row in a different workbook. The data goes into columns A:J and a formula works out the data in column K. I need to be able to get the data from that specific cell in Column K into a msgbox but I'm struggling to get to work. It's the...
  12. Sharid

    A little help need on adding values in column

    Why is this not working I want to add all the values in column B from row 4 down to last cell with data and the past the TOTAL in Cell B2 Private Sub CommandButton1_Click() Dim myRange myRange = ActiveSheet.Range("B4", Range("B4").End(xlDown)) Range("B2") =...
  13. J

    Search and show multiple results on another sheet

    Hi, I have a database that has 11 columns in one sheet and I have created a search in another sheet with a search button, clear button and print button it works but it only shows one result and not multiple for example I could have more than one of the same code in column A so I need it to show...
  14. Seba Robles

    [VBA] Find & Replace with Loop for Named Range

    Hello, I'm not very familiarized with loops and would like your help. I'm trying to create a code where I will Find text from a named range and Replace it from a List Sheet 1 has myRange named Sheet 2 has a List; Column A myFind and Column B myReplace myFind is the text I want to find...
  15. J

    Find partial string and then paste whole cell contents as an offset to another 'searched for' string

    I know that's title gore and I am sorry - that was my best effort! I need some VBA to help search for the word "Qualification" which will always be found ONCE in column A. Once found I need to copy the whole cell contents and paste it to the left of cell that contains the string "Name" (which...
  16. R

    Macro Help (Of Course)

    This is my Issue: I have a Macro that creates Worksheets and names them, names are taken from a Pre-Defined Range list in a specific worksheet called Setup. That macro works perfectly. ___________________________ Sub CreateSheets() Dim MyCell As Range, MyRange As Range Set MyRange =...
  17. L

    How to do "Text to Columns" on several columns at once.

    Hi, everybody I obtained the foll. code from a book by a well-known Excel MVP and author. So, I found it a bit strange why it does not work. I copied the code from both its web-site and from the book. Sub Macro47() 'Step 1: Declare your variables Dim MyRange As Range Dim MyCell As...
  18. T

    Find and Replace Macro Not Working

    This macro was posted in MrExcel some time ago and I found it on the internet in a search. I tried running it but it doesn't work. Any suggestions please? Thank you, Jared Z. Sub Find_and_Replace() Dim myList, myRange Set myList = Sheets("Run Macros").Range("F1:G13") 'two column range...
  19. M

    Writing a Macro to determine the amount of work days between two dates.

    I am trying to write a macro that will compare 2 cells, then will take the dates corresponding to those cells and tell me the amount of week days between the 2 dates. The part I'm having trouble with is the IF i wrote Sub DateCalculation() ' ' DateCalculation Macro ' ' Keyboard Shortcut...
  20. B

    Setting and unsetting a range when returned from function.

    This is a clean code question: I have always been taught that after setting a range in vba code, that to free up resources I need to reset the range object back to Nothing after I have used it (eg Set MyRange = Nothing). However, when I set a range in the return value of function I do not seem...

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
Top