seajey: Electronic Knight (Default)
[personal profile] seajey
И снова меня мучает Visual Basic :(

Есть столбец D, в его ячейках может быть записаны числа 0, 1, 2 или вообще ничего.
Нужно обойти его в цикле, и, если i-тая ячейка содержит цифру 1 - закрасить строку диапазоне Bi:BAi определенным цветом.

Пока из обрывков разных макросов удалось сваять это:

Sub ColorLoneCityRow()
'
 Dim i As Integer
 i = 8

 While Range("D" + CStr(i)).Text <> "***"
	Select Case Range("D" + CStr(i)).Value
		Case 1
		
			Range("B" + CStr(i) + ":BA" + CStr(i)).Select
			With Selection.Interior
				.ColorIndex = 44
				.Pattern = xlSolid
			End With
	End Select
	i = i + 1
 Wend

End Sub


И, о Боже! Оно даже работает!
This account has disabled anonymous posting.
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

seajey: Electronic Knight (Default)
SeaJey

April 2020

S M T W T F S
   1234
567891011
12131415161718
1920212223 2425
2627282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 6th, 2026 04:03 pm
Powered by Dreamwidth Studios