i have a simple code which i cant get to work i want to divide one row by another
where am i going wrong!!
thanks in advance
Dim w2 As Worksheet
Dim c As Range
Dim lastrow1 As Long
Dim wf1 As Long
Dim fn As Range
Dim sn As Range
Set w2 = Sheets("top50")
lastrow1 = w2.Cells(Cells.Rows.count, "A").End(xlUp).Row
For Each c In w2.Range("c2:c" & lastrow1)
Set fn = c.Offset(, 2)
Set sn = c.Offset(, 3)
wf1 = sn.Value / fn.Value ****i want to divide these two rows
c.Offset(, 4).Value = wf1 / c.Offset(, 2).Value ****and put the answer here
wf1 = 0
Keys to the Problem divide vba
Hi. If it's just simple division without error checking, perhaps the following idea:
With Range(Cells(2, 1), Cells(Cells(Cells.Rows.Count, 1).End(xlUp).Row, 1))
.Offset(0, 3) = .Offset(0, 1).Value
.Offset(0, 3).PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide
Application.CutCopyMode = False
- Go to the Start button.
- In the Search box, type "cmd" (without quotes) and press Enter.
- At the command prompt, type "chkdsk /r /f" (without quotes) and press Enter.
- Restart your computer.
Recommended Method to Repair the Problem: divide vba:
How to Fix divide vba with SmartPCFixer?
1. Click the button to download SmartPCFixer . Install it on your computer. Open it, and it will perform a scan for your computer. The errors will be shown in the scan result.
2. After the scan is finished, you can see the errors and problems need to be repaired. Click Fix All.
3. When the Fixing part is done, your computer has been speeded up and the errors have been fixed
Related: Way to Update & Download SONY SVE14A2X1EH Wireless State Device driver,How to Update & Download SONY SVS1511X9RB Graphics Driver for D2 (Intel) v.9.17 - 126.96.36.19928,Method to Download SONY VGN-CR290N Realtek High Definition Audio Driver v.188.8.131.5233,Download SONY VGN-FS710/W Utilities DLL Update v.6.4.0.06290 driver,Method to Update & Download SONY VGN-NR460E/P Intel Graphics Media Accelerator Driver v.184.108.40.20647,How to Fix Error 0x0000c1f5 Solución?,Error 0x80071a91 Win7 Fix Patch,Error 0x800ccc60 Windows Live Mail [Solved],Error Message 0x800ccc79 Outlook 2000 Fix,What is Error 0xc1ab0001?,[Answered] x64 saplugin dll,How to Fix Problem - Kb943729 Download?,Troubleshooting: Bccode D1 Error,Java Runtime Tech Support,Troubleshooting: ERROR NO SUCH GROUP Error,Solution to ashoutxt.dll Missing Error,Solution to cxcore096.dll Missing Error,Where can I Find dsauth.dll File,How to Fix msde.dll Not Found Error,Best Method to Fix psizewizres.dll Error
Read More: Solution to Error: Domain DNS and connecting to alternative network,Solution to Problem: Distribute a dll library with an Excel workbook,How to Fix Problem - Driver for the Oki C5500 printer on Windows 7 64Bit?,[Solution] Downloading Through Internet Explorer 11,Fast Solution to Problem: Document Recovery after Blue Screen,Data validation question. Maintaining and updating named ranges.,Desktop Gadget Gallery on Windows 7,delete empty rows,Deleting a page and also how can I copy an exact page lay out on a new page,Date Formula for 1st Sunday of each Month (3rd to 9th)