ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help using VBA in excel. (https://www.excelbanter.com/excel-programming/317953-need-help-using-vba-excel.html)

Chris

Need help using VBA in excel.
 
The following is some VBA code being run using a Macro.

ActiveCell.Select
Selection.Interior.ColorIndex = 34
Range("G4").FormulaR1C1 = "=countbycolor(Belmarsh,34,FALSE)"
End Sub

"Belmarsh" is a cell range. Is there any way of inputting a cell specific
cell range i.e. E11:B12 or $E$11:$B$12 in VBA. Whenever I try this it errors.
Any ideas??

Thanks

Chris

Tom Ogilvy

Need help using VBA in excel.
 
Range("G4").Formula = "=countbycolor(E11:B12,34,FALSE)"

should work. Notice since the formula is in A1 notation, i use Formula
rather than FormulaR1C1

--
Regards,
Tom Ogilvy


"Chris" wrote in message
...
The following is some VBA code being run using a Macro.

ActiveCell.Select
Selection.Interior.ColorIndex = 34
Range("G4").FormulaR1C1 = "=countbycolor(Belmarsh,34,FALSE)"
End Sub

"Belmarsh" is a cell range. Is there any way of inputting a cell specific
cell range i.e. E11:B12 or $E$11:$B$12 in VBA. Whenever I try this it

errors.
Any ideas??

Thanks

Chris




Frank Kabel

Need help using VBA in excel.
 
Hi
with activesheet.range("B11:E12")
..Interior.ColorIndex = 34
end with

--
Regards
Frank Kabel
Frankfurt, Germany

"Chris" schrieb im Newsbeitrag
...
The following is some VBA code being run using a Macro.

ActiveCell.Select
Selection.Interior.ColorIndex = 34
Range("G4").FormulaR1C1 = "=countbycolor(Belmarsh,34,FALSE)"
End Sub

"Belmarsh" is a cell range. Is there any way of inputting a cell

specific
cell range i.e. E11:B12 or $E$11:$B$12 in VBA. Whenever I try this it

errors.
Any ideas??

Thanks

Chris



Don Guillett[_4_]

Need help using VBA in excel.
 

try
ActiveCell.Interior.ColorIndex = 34
Range("G4").Formula= "=countbycolor(range("e11:b12"),34,FALSE)"


--
Don Guillett
SalesAid Software

"Chris" wrote in message
...
The following is some VBA code being run using a Macro.

ActiveCell.Select
Selection.Interior.ColorIndex = 34
Range("G4").FormulaR1C1 = "=countbycolor(Belmarsh,34,FALSE)"
End Sub

"Belmarsh" is a cell range. Is there any way of inputting a cell specific
cell range i.e. E11:B12 or $E$11:$B$12 in VBA. Whenever I try this it

errors.
Any ideas??

Thanks

Chris




Don Guillett[_4_]

Need help using VBA in excel.
 
wrong
Range("G4").Formula= "=countbycolor(range("e11:b12"),34,FALSE)"

right
Range("G4").Formula= "=countbycolor(e11:b12,34,FALSE)"



--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...

try
ActiveCell.Interior.ColorIndex = 34
Range("G4").Formula= "=countbycolor(range("e11:b12"),34,FALSE)"


--
Don Guillett
SalesAid Software

"Chris" wrote in message
...
The following is some VBA code being run using a Macro.

ActiveCell.Select
Selection.Interior.ColorIndex = 34
Range("G4").FormulaR1C1 = "=countbycolor(Belmarsh,34,FALSE)"
End Sub

"Belmarsh" is a cell range. Is there any way of inputting a cell

specific
cell range i.e. E11:B12 or $E$11:$B$12 in VBA. Whenever I try this it

errors.
Any ideas??

Thanks

Chris






Tom Ogilvy

Need help using VBA in excel.
 
Maybe you mean something like

Range("G4").Formula= "=countbycolor(" & _
range("e11:b12").Address & ",34,FALSE)"

--
Regards,
Tom Ogilvy


"Don Guillett" wrote in message
...

try
ActiveCell.Interior.ColorIndex = 34
Range("G4").Formula= "=countbycolor(range("e11:b12"),34,FALSE)"


--
Don Guillett
SalesAid Software

"Chris" wrote in message
...
The following is some VBA code being run using a Macro.

ActiveCell.Select
Selection.Interior.ColorIndex = 34
Range("G4").FormulaR1C1 = "=countbycolor(Belmarsh,34,FALSE)"
End Sub

"Belmarsh" is a cell range. Is there any way of inputting a cell

specific
cell range i.e. E11:B12 or $E$11:$B$12 in VBA. Whenever I try this it

errors.
Any ideas??

Thanks

Chris







All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com