Hi Question About VBA code for Sorting a-z just column B, but i have a few merged cells

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,079
Office Version
  1. 365
Platform
  1. Windows
HI I want to sort column B down in a-z sort. From B4 to B190. My problem is from B1 to B3 is merged cells and I need to leave it. I need to work around so I can sort the rows below B4 and down without get the error. This operation requires the merged cells to be identically sized.
An vba code on this would help thanks.
 
Sub AtoZ()


With ActiveSheet.Sort
.SetRange Range("B4:B190")
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End Sub

I used that at first changed the number of cells a couple of times, but no sorting will try code above now.
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Did you try the Macro Recorder like I recommended?
Record yourself sorting it manually, and it should give you the code you need.
 
Upvote 0
Let me ask you guys something. If i wanted to add a file on a sheet like a button to upload 1 file and then put data to percific cells on another sheet on same book. Do i need to record anything or it has to be written up? New at VBA but want to go for it.
 
Upvote 0
i recorded macro and got code
So, does this mean you are good now?

Let me ask you guys something. If i wanted to add a file on a sheet like a button to upload 1 file and then put data to percific cells on another sheet on same book. Do i need to record anything or it has to be written up? New at <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: rgb(0, 0, 0); cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VBA</acronym> but want to go for it.
It is generally best to post new questions in their own, new threads. Then they show up as a new unanswered question on the "Zero Reply Posts" listing.

You typically only continue on in the same thread if the new question is a follow-up that is dependent upon the previous question (meaning it wouldn't make much sense by itself).
 
Upvote 0
Your funny. Yes i agree just wanted to ask thank you.
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,645
Members
449,461
Latest member
kokoanutt

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