VB Question

earthsuiter

New Member
Joined
Jul 14, 2009
Messages
34
Good Afternoon,

I'm tring to figure out what the VB code I would need to do the following:

Look at all values in column B
If value = "break" then .RowHeight = 2.5

Thanks for your time.
Tim
 
Peter,

When I use this Macro code, I'm getting 80 + rows that are all 2.5mm big after it reads the "!" value. Any ideas?

Sub alignment()
Dim LR, i As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LR
Select Case Range("A" & i).Value
Case "^": Rows(i).RowHeight = 2.5
Case "!": Rows(i).Resize(3).Insert
Case "@": Rows(i & ":" & LR).Cut Destination:=Sheets("Sheet2").Range("A1"): Exit Sub
End Select
Next i
End Sub
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try

Code:
Sub alignment()
Dim LR, i As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    Select Case Range("A" & i).Value
        Case "^": Rows(i).RowHeight = 2.5
        Case "@": Rows(i & ":" & LR).Cut Destination:=Sheets("Sheet2").Range("A1"): Exit Sub
    End Select
Next i
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
    Select Case Range("A" & i).Value
        Case "!": Rows(i).Resize(3).Insert
    End Select
Next i
End Sub
 
Upvote 0
Peter, the RowHeight = 15 doesn't work.
Do you know what's wrong with this code?
Thanks alot!

Sub alignment()
Dim LR, i As Long
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To LR
Select Case Range("A" & i).Value
Case "^": Rows(i).RowHeight = 2.5
End Select
Next i
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
Select Case Range("A" & i).Value
Case "!": Rows(i).Resize(1).Insert RowHeight = 15
End Select
Next i
Columns("A:A").ColumnWidth = 0.1
Columns("B:B").ColumnWidth = 28.57
Columns("C:C").ColumnWidth = 21.14
Columns("D:D").ColumnWidth = 20.14
Columns("E:E").ColumnWidth = 5.43
Columns("F:F").ColumnWidth = 5.43
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,004
Members
452,374
Latest member
keccles

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