Posts by busybee_1_in

    I am trying to search for a string in Column A of a worksheet. I have the following code.


    Code
    Set rng1 = ws1.Range("A:A").Find(What:=searchString)


    This code returns Nothing if searchString is present in Cell A1. It sets rng1 to the correct cell otherwise. Any suggestions to set rng1 to "A1" if searchString is present over there?

    I have created a UserForm in Excel VBA. I have added a ListBox with Check Box functionality by setting the ListStyle property to fmListStyleOption and MultiSelect property to fmMultiSelectMulti.


    Since I have checkboxes in my List Box, is it possible to write code to avoid highlighting an item in the ListBox when it is selected?

    I realized the Worksheet.Sort method always places the blank cells in a column below the cells with data. The purpose of my application was to only keep rows with the highest sublevels of data such as row 7 in the first image and delete the rest.


    I resolved this issue by applying Sort xlAscending on the range and then created a for loop to loop through the range from the last row to the first row and deleting the selected row if necessary.

    I am attempting to sort a range of cells in Excel using the Sort method. Some of the cells in the range are blank. After executing the below Excel VBA code, the range is sorted so the cells with data appear above the empty cells. How do I ensure the empty cells appear above the cells with data? A snapshot of my Excel sheet before and after execution are attached.