I have a column that has many blanks and entries. I want to take the entries (ignoring the blanks) and move them over to the right once and down twice replacing the contents. I have a feeling you would use the offset function, however I don't know how to write this in VBA. I've only used offset as a formula. Any help would be appreciated...
相关问题
- Excel sunburst chart: Some labels missing
- Error handling only works once
- Error handling only works once
- Excel formula in VBA code
- Excel VBA run time error 450 from referencing a ra
相关文章
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
- Unregister a XLL in Excel (VBA)
- Unregister a XLL in Excel (VBA)
- How to prevent excel from truncating numbers in a
- numeric up down control in vba
- Declare a Range relative to the Active Cell with V
- What's the easiest way to create an Excel tabl
First you need to create a loop, that moves through all the values of your range. There many ways to create loops, but here is one example:
Then I recommend to loop through the range and check each cell value for your criteria using the IF function:
Now in order to copy all values in a new range, just set the values of the old and new cell equal:
In summary your code would look something like this:
here's a one liner:
or, should your "not blank" cells derive from formulas in the cells: